How to sort an array who's sorting order is in another array? : // 0 =  eldest = pre
//everytime i run this code i get names in pattern that makes no sense to me

public class cousin {

	public static void main(String[] args) 
	{
		String[] children = {"Arm", "Jo", "Ra", "Jas", "Pre", "She"};
		
		int[] sortAge =			 {2, 4, 3, 5, 0, 1};
		
		int x = 0;
		int y = 1;
		
		
		while ( x < 6)
		{
			int ref = sortAge[x];	
			System.out.print(y+ "\t");
			System.out.println(children[ref]);
			x = x + 1;
			y = y + 1;		}
		
	}

}
