Java Collection framework in arrays
class ASC { public static void main(String args[]) { ArrayList<Integer> find=new ArrayList<Integer>();1 8 9 2 6 6 Scanner s=new Scanner(System.in); for(int i=0;i<5;i++) { int temp=s.nextInt();//temp=8 if(!find.contains(temp))//true find.add(temp);//[1 8 9 2 6] } Collections.sort(find);[1 2 6 8 9] System.out.println(find); }}