public static String formatIntegerIfPossible(double value,int numberOfDigits,boolean groupingCharacter){
  if (Double.isNaN(value)) {
    return "?";
  }
  if (Double.isInfinite(value)) {
    if (value < 0) {
      return "-" + FORMAT_SYMBOLS.getInfinity();
    }
 else {
      return FORMAT_SYMBOLS.getInfinity();
    }
  }
  long longValue=Math.round(value);
  if (Math.abs(longValue - value) < epsilonDisplayValue) {
    INTEGER_FORMAT.setGroupingUsed(groupingCharacter);
    return INTEGER_FORMAT.format(value);
  }
  return formatNumber(value,numberOfDigits,groupingCharacter);
}

public static String formatIntegerIfPossible ( double value , int numberOfDigits , boolean groupingCharacter ) { if ( Double . isNaN ( value ) ) { return "?" ; } if ( Double . isInfinite ( value ) ) { if ( value < 0 ) { return "-" + FORMAT_SYMBOLS . getInfinity ( ) ; } else { return FORMAT_SYMBOLS . getInfinity ( ) ; } } long longValue = Math . round ( value ) ; if ( Math . abs ( longValue - value ) < epsilonDisplayValue ) { INTEGER_FORMAT . setGroupingUsed ( groupingCharacter ) ; return INTEGER_FORMAT . format ( value ) ; } return formatNumber ( value , numberOfDigits , groupingCharacter ) ; }
returns a number string with no fraction digits if possible . otherwise the given number of digits will be returned .
