public static Number wrapNumber(final double n,final boolean integer){
  if (integer) {
    return (long)n;
  }
 else {
    return n;
  }
}

public static Number wrapNumber ( final double n , final boolean integer ) { if ( integer ) { return ( long ) n ; } else { return n ; } }
" boxes " a double value as either double or long depending on the integer flag .
