public static int scan(long v){
  if (v == 0) {
    return -1;
  }
  return Long.numberOfTrailingZeros(v);
}

public static int scan ( long v ) { if ( v == 0 ) { return - 1 ; } return Long . numberOfTrailingZeros ( v ) ; }
utility method with defined return value for 0 .
