Java Utililty Methods Integer Create

List of utility methods to do Integer Create

Description

The list of methods to do Integer Create are organized into topic(s).

Method

inttoInt(String s, int exception)
to Int
try {
    return Integer.parseInt(s);
} catch (NumberFormatException e) {
    return exception;
inttoInt(String sInt)
Convert a string representation of an integer with comma into an int value
if (sInt == null)
    throw new NullPointerException();
String intWithoutComma = sInt.replaceAll("[ ,]", "");
return Integer.parseInt(intWithoutComma);
inttoInt(String str)
to Int
return toInt(str, -1);
inttoInt(String str)
to Int
return isValid(str) ? Integer.parseInt(str) : 0;
inttoInt(String str)
to Int
return checkStr(str) ? Integer.parseInt(str) : 0;
inttoInt(String str)
to Int
if (str == null) {
    return 0;
} else {
    try {
        return Integer.parseInt(str);
    } catch (NumberFormatException var3) {
        return 0;
inttoInt(String str)
to Int
return toInt(str, 0);
inttoInt(String str)
to Int
return toInt(str, 0);
inttoInt(String str)

Convert a String to an int, returning zero if the conversion fails.

If the string is null, zero is returned.

 NumberUtils.toInt(null) = 0 NumberUtils.toInt("")   = 0 NumberUtils.toInt("1")  = 1 
return toInt(str, 0);
IntegertoInt(String str)
to Int
return Integer.parseInt(str);