waltermilner

Untitled

Apr 10th, 2016
486
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.32 KB | None | 0 0
  1. import java.util.Arrays;
  2.  
  3. public class Test {
  4.  
  5.   public static void main(String[] args) {
  6.     Integer[] a = {8, 7, 6, 4, 3, 2, 1, 0};
  7.     Arrays.sort(a);
  8.     int n = a.length - 1;
  9.     for (int i = 0; i < n; i++) {
  10.       if (!(a[i] == i)) {
  11.         System.out.println(i); // 5
  12.         break;
  13.       }
  14.     }
  15.  
  16.   }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment