I am writing this program that takes a file of integers, sorts the integers, and prints the sorted list into a different output file. I have all of this working fine, I am stumped as to how to incorporate a counter.
I want to print the number of times a number appears that is less than 10.
here is my code at this point:
import java.io.*;
import java.util.Scanner;
/**
*
* @author Christie
*/
public class insertionSortMain {
public static void main(String[] args)throws IOException {
// TODO code application logic here
int nums[] = new int[20];
getInsertionSort(nums);
showNums(nums);
}
}
public static void getInsertionSort(int[]array){
int temp, j;
for (int i = 1; i < array.length; i++) {
temp = array[i];
j = i - 1;
while ((j >= 0) && (array[j] > temp)) {
array[j + 1] = array[j];
j--;
}
array[j + 1] = temp;
}
}
}
I want the number to be the first number in the list of the output file