List of utility methods to do Number Convert to
Character | NumberToCharacter(final Number value) Number To Character return value == null ? null : (char) value.intValue(); |
String | numberToFormattedString(Double d) number To Formatted String String s = d.toString(); if (s.endsWith(".0")) { return s.substring(0, s.length() - 2); } else if (s.length() > 7) { return String.format("%.6g", d); } else { return s; |
String | numberToJson(Number number) number To Json return number.toString();
|
void | numberToMinterm(int num, int length, int index, boolean[] output) encode the number as a boolean vector, starting from the given index. for (int i = 0; i < length; i++) output[index++] = ((num & (1L << i)) != 0); |
String | numberToOrdinal(int i) number To Ordinal return i % 100 == 11 || i % 100 == 12 || i % 100 == 13 ? i + "th" : i + ORDINAL_SUFFIXES[i % 10]; |
String | numberToPaddedHexString(int number, int size) number To Padded Hex String String s = Integer.toHexString(number); if (s.length() > size) { throw new IllegalArgumentException("Number too big for padded hex string"); StringBuffer buf = new StringBuffer(); for (int i = 0; i < (size - s.length()); i++) { buf.append('0'); buf.append(s); return buf.toString(); |
long | numberToPrimitiveLong(Object o) number To Primitive Long long i; if (o instanceof Long) i = ((Long) o).longValue(); else if (o instanceof Integer) i = ((Integer) o).longValue(); else if (o instanceof Short) i = ((Short) o).longValue(); else if (o instanceof Byte) ... |
Double | NumberToReal(Object n) converts a instance to a Double. if (n == null) return null; return new Double(((Number) n).doubleValue()); |