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 may create a new array (in this case, `filteredArray`) in which you store all the elements in `myArray` but the greatest two.
Also, it is better to save the indexes of the two biggest numbers rather than their values in order to be able to filter them out more easily.

This should work (you will find the array you want in `filteredArray`).

```
int n = sc.nextInt();
int [] myArray = new int[n];
int first = 0;
int second = 0;
for(int i = 0; i < myArray.length; i++) {
    myArray[i] = sc.nextInt();
    if (myArray[i] > myArray[first]) {
        second = first;
        first = i;
    } else if(myArray[i] > myArray[second]) {
        second = i;
    }
}
int [] filteredArray = new int[n-2];
int skipped = 0;
for(int i = 0; i < myArray.length; i++) {
    if(i != first && i != second)
        filteredArray[i - skipped] = myArray[i];
    else
        skipped++;
}

```