1int [] arr = {1,1,1,2,2,2,3,3,3,4,4,5,5,6,7,8,};
2
3for (int j= 0; j < arr.length; j++){
4int count1 = 0; // to find out how many time value is appeared in the arry
5for (int i = 0; i < arr.length; i++){
6 if(arr[i] == arr[j] ) {
7 // if(arr[i] == 1 ) { once boyleydi ikinci for gelince soldaki oldu
8 count1++; // arraydeki harfleri tek tek saymak icin
9 }
10 }
11 if(count1 == 1 ){
12 System.out.print(arr[j]+" ");// 6 7 8 uniqe
13 }
1import java.util.ArrayList;
2
3public class UniqueNumbersInArray {
4
5 public static void main(String[] args) {
6
7
8 int arr[] = { 4,5,5,4,5,6,5,8,4,7};
9
10 ArrayList<Integer> uniqueArr = new ArrayList<Integer>();
11 for (int i = 0; i < arr.length; i++) {
12
13 int k = 0;
14 if (!uniqueArr.contains(arr[i])){
15 uniqueArr.add(arr[i]);
16 k++;
17
18 for (int j = i; j < args.length ; j++) {
19 if (arr[i]==arr[j]){
20 k++;
21 }
22 }
23
24 System.out.println(arr[i]);
25 System.out.println(k);
26 }
27
28 }
29 }
30}