fork(4) download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. int [] array = { 0, 7, 9, 1, 5, 8, 7, 4, 7, 3};
  9. int pointer=0;
  10. int currNumber;
  11. while(pointer<array.length)
  12. {
  13. currNumber=array[pointer];
  14. for(int i=0;i<array.length;i++){
  15. if(currNumber==array[i] && i>pointer){
  16. System.out.println("Duplicate for "+currNumber +" in " +i);
  17. break;
  18. }
  19. }
  20. pointer++;
  21. }
  22. }
  23. }
Success #stdin #stdout 0.02s 245632KB
stdin
Standard input is empty
stdout
Duplicate for 7 in 6
Duplicate for 7 in 8