How do I find the two largest elements in an array?

558fe5180e0e8fc922d31c23ef84d240

I'm having trouble in my assignment
Assignment :: TwoLargestElements
Complete the following program so that it computes and writes out the two largest elements in the array.
It always display "12" on both largest and largest2

import java.io.* ;    
public class TwoLargest  {      
 public static void main ( String[] args ) 
                     throws IOException    {      
 int[] data = {3, 1, 5, 7, 4, 12, -3, 8, -2};            
 int largest = 0, largest2 = 0;                       
  for ( int index = 0; index < data.length; index++)      
  if(largest < data[index]) {
  largest = data [index];
  }
  for ( int index = 0; index < data.length; index++)
  if (largest2 < largest) {  
    largest2 = largest;
  }
  System.out.println("The largest number in the array is: " + largest);
  System.out.println("The second largest number in the array is: " + largest2); 
 }
}

Jumble word through user input

558fe5180e0e8fc922d31c23ef84d240

(Jumble word program) (plz guys help me to make this program)

user enter few characters randomly, then press enter, (your program stores 50 names of your class fellows)
if by rearranging your entered characters it matches to the names stored,
then it will show it, otherwise it will show that name does not exist.

for example.... user enter llohe
correct name already declare (hello) program show this name