I can fill my array,and found the two of biggest numbers.But,i can not delete it.May u guys could help me?

```
  int n = sc.nextInt();
  int [] myArray = new int[n];
  int first = 0;
  int second = 0;
       for(int i = 0; i < myArray.length; i++) {
    int num = sc.nextInt();`
       if (num > first) {
         second = first;
         first = num;
    } else if(num > second) 
      {
      second = num;
      }
     }

   System.out.println("The largest  " + first+ "The second largest  " + second);

```
['https://Stackoverflow.com/questions/42713907', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7513001/']
If you are using Java 8 you can sort your array then you can loop throw your array and set it values to the other one avoiding the last two Integer for example :

```
//Your array
Integer[] array = {8, 99, 6, 336, 2};

//sort your array this can give your [2, 6, 8, 99, 336]
Arrays.sort(array);

//create a new array with the length = array - 2 if the length of array < 2 then 0
Integer[] array2 = new Integer[array.length > 2 ? array.length - 2 : 0];

//copy your array into the array2 avoiding the 2 last
System.arraycopy(array, 0, array2, 0, array.length > 2 ? array.length - 2 : 0);

//print your array, this will print [2, 6, 8]
System.out.println(Arrays.toString(array2));

```
You can simply sort the array and find or remove the two biggest elements. 

```
int [] myArray = new int[]{14,5,2,16,18,20};
System.out.println("The original array is "+ " " +Arrays.toString(myArray));
Arrays.sort(myArray);
System.out.println("The sorted array is "+ " " +Arrays.toString(myArray));;

int fisrtmax = myArray[myArray.length-1];
int secondmax = myArray[myArray.length-2];

System.out.println("The first biggest number is " + fisrtmax+ "  The second biggest number is " + secondmax);

int [] arrafterremove= Arrays.copyOf(myArray, myArray.length-2);

System.out.println("The array after removing the two biggest numbers is " + Arrays.toString(arrafterremove));

```

**RUN**

```
The original array is  [14, 5, 2, 16, 18, 20]
The sorted array is  [2, 5, 14, 16, 18, 20]
The first biggest number is 20  The second biggest number is 18
Array after removing the two biggest numbers is [2, 5, 14, 16]

```