class Power2 { public static long pow(long x, long y) { // return x to the power of y long half; if ( y == 0 ) { return 1; } else if ( y%2 == 0 ) { half = pow(x,y/2); return half*half; } else { half = pow(x,(y-1)/2); return half*half*x; } } public static void main(String[] args) { System.out.println( pow(1,1000000L) ); } }