public static int log2(long arg){
  if (arg <= 0)   throw new IllegalArgumentException("log2() requires positive number!");
  return 63 - Long.numberOfLeadingZeros(arg);
}

public static int log2 ( long arg ) { if ( arg <= 0 ) throw new IllegalArgumentException ( "log2() requires positive number!" ) ; return 63 - Long . numberOfLeadingZeros ( arg ) ; }
compute the log2 of a given number . this is also the minimum # of bits to store this value . requires a positive value for an argument . if there ' s a better way , please replace this .
