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));

```
May be following code will useful for you 

```
again :
for (int i = 0; i < n; i++) 
{            
     if ((a[i] < a[i+1]) && (i+1)<n)  
     {
         temp = a[i];
         a[i] = a[i+1];
         a[i+1] = temp;
         continue again;
     }           
}
System.out.println("The largest  " + a[0] + " & second largest " + a[i]);

```

IF you want to delete other then you can do that 

```
for(int i=2; i<n ; i++)
   test = ArrayUtils.remove(a, i);

```