inputs numbers then outputs how many time a particular number appears

Ok, this is what my teacher wants me to do:

Write a program that reads a set of positive integers and outputs how many times a particular number appears in the list. You may assume that the data set has at most 100 numbers and -999 marks the end of the input data. The numbers must be output in increasing order. For example, for the data:

15 40 28 62 95 15 29 13 62 65 48 95 62 65 95 95 -999

The output is:

Number Count

13_____1

15_____2

28_____2

40_____1

48_____1

62_____3

65_____3

95_____4

and this is what I came up with

Code:

`import java.io.*;`

import java.util.*;

public class Numbers{

public static void main(String[]args)throws Exception{

Scanner sc = new Scanner(System.in);

int[] number = new int[100];

int[] counter = new int[100];

int i, j, c=0;

for(i = 0;i<number.length; i++){

System.out.print(" ");

number[i] = sc.nextInt();

if (number[i]== -999){

break;

}

}

Arrays.sort(number);

System.out.println("Numbers\tCounts");

for (i=2; i<number.length;i++){

if (i!=0){

if(number[i]==number[i-1]){

do{

i=i+1;

counter[i-2]=c+1;

}while(number[i]==number[i-1]);

}

}

System.out.println(number[i]+"\t"+counter[i-2]);

}

}

}

I need some help because for some reasons.. this program doesn't do the thing I want it to do. And I'm out of ideas! :(

Please, even a little help would be much appreciated.