public class Shuffle1 { public static int [] shuffle( int[] x ) { int[] out = new int[52]; int j = 0; for ( int i = 0; i < 26; i++ ) { out[j++] = x[i]; out[j++] = x[26+i]; } return out; } public static void print( int[] x ) { int k = 0; for ( int i = 0; i < 2; i++ ) { for ( int j = 0; j < 26; j++ ) System.out.print(x[k++] + " "); System.out.println(); } System.out.println(); } public static void main( String[] args ) { int i; int[] x = new int[52]; for ( i = 0; i < 52; i++ ) x[i] = i+1; System.out.println("Original deck:"); print(x); for ( i = 0; i < 8; i++ ) { x = shuffle(x); System.out.println("After shuffle #" + i + ":"); print(x); } } }