Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

unique elements in array java

int [] arr = {1,1,1,2,2,2,3,3,3,4,4,5,5,6,7,8,};

for (int j= 0; j < arr.length; j++){
int count1 = 0; // to find out how many time value is appeared in the arry
for (int i = 0; i < arr.length; i++){
     if(arr[i] == arr[j] ) {    
    // if(arr[i] == 1 ) { once boyleydi ikinci for gelince soldaki oldu
      count1++; // arraydeki harfleri tek tek saymak icin
  }
 }
    if(count1 == 1 ){
    System.out.print(arr[j]+" ");// 6 7 8 uniqe
 }
Comment

PREVIOUS NEXT
Code Example
Java :: java connect socket to POP3 
Java :: SmallChange 
Java :: how to add a singleton hashset in java 
Java :: how to split string with dolor sign in java 
Java :: string equlity 
Java :: Iterating an Array Using While Loop 
Java :: An exception occurred processing JSP page /Home.jsp 
Java :: .throwFor in java 
Java :: EXPECTTIONS JAVA 
Java :: gradle project load test data json file with jackson 
Java :: how to preset an array java 
Java :: validate text field netbeans emails 
Java :: how to mutate value in vector in java 
Java :: Creating strings using the new keyword Java 
Java :: java -jar -l resourceses.porperties -i ejemplo.txt -o inject.bin 
Java :: [ERROR] Error executing Maven. java.io.FileNotFoundException: The specified user settings file does not exist: /usr/lib/jvm/java-1.8.0-openjdk-amd64 
Java :: leak canary 
Java :: java pattern matching 16 
Java :: capitalize a letter in java 
Java :: Join Two Variables Together In Java 
Java :: List Double, fixed size 
Java :: java to exe 
Java :: zebra zpl print java 
Java :: number output swing java 
Java :: java notnull returns null 
Java :: java interview question answer 
Java :: javalin pom 
Java :: variables en java 
Java :: java reverse nodes with single node 
Java :: java pebble replacestart 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =