question: public static double twoPow ( int power ) { if ( power <= - MAX_DOUBLE_EXPONENT ) { if ( power >= MIN_DOUBLE_EXPONENT ) { return Double . longBitsToDouble ( 0x0008000000000000L > > ( - ( power + MAX_DOUBLE_EXPONENT ) ) ) ; } else { return 0.0 ; } } else if ( power > MAX_DOUBLE_EXPONENT ) { return Double . POSITIVE_INFINITY ; } else { return Double . longBitsToDouble ( ( ( long ) ( power + MAX_DOUBLE_EXPONENT ) ) << 52 ) ; } }
target:  net.jodk.FastMath class has a typically faster version of this method, using look-up tables. Returns the exact result, provided it's in double range, i.e. if power is in [-1074,1023].