Java Utililty Methods Number Value Of

List of utility methods to do Number Value Of

Description

The list of methods to do Number Value Of are organized into topic(s).

Method

TvalueOf(Class enumType, int ordinal)
value Of
for (T value : enumType.getEnumConstants()) {
    if (value.ordinal() == ordinal) {
        return value;
return null;
booleanvalueOf(final Boolean value)
Returns false when the value is null.
return value == null ? false : value.booleanValue();
FloatvalueOf(float f)
value Of
return new Float(f);
IntegervalueOf(int i)
value Of
if (i >= 0 && i < INTEGER.length) {
    return INTEGER[i];
} else {
    return new Integer(i);
booleanvalueOf(int i)
value Of
return (i != 0);
booleanvalueOf(int number)
Converts a primitive integer to boolean by assuming 0 is false and everything else (1) is true.
return 0 == number ? false : true;
StringvalueOf(int[] source)
Utility method to take a int[] containing codepoints and return a string representation with code units.
StringBuilder result = new StringBuilder(source.length);
for (int i = 0; i < source.length; i++) {
    result.appendCodePoint(source[i]);
return result.toString();
intvalueOf(Integer value)
value Of
if (value != null) {
    return value;
return 0;
IntegervalueOf(Integer value)
value Of
return value != null ? value : 0;
shortvalueOf(Short value)
value Of
return valueOf(value, (short) 0);