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

inttoInteger(String str)
to Integer
return toInteger(str, Integer.MIN_VALUE);
inttoInteger(String str)
Transforma um String em Inteiro
Caso a String nao seja um Inteiro valido, retorna 0
return toInteger(str, 0);
inttoInteger(String string)
to Integer
if (isEmpty(string)) {
    return 0;
try {
    return Integer.parseInt(string);
} catch (NumberFormatException ex) {
    return 0;
IntegertoInteger(String string, Integer deff)
to Integer
Integer value = deff;
try {
    if (string != null) {
        value = Integer.valueOf(string.toString());
} catch (NullPointerException e) {
    e.printStackTrace();
return value;
IntegertoInteger(String val)
to Integer
return isBlank(val) ? null : new Integer(val.trim());
IntegertoInteger(String value)
Converts the specified value string to the Integer value.
if (value == null || value.equals("")) {
    return null;
try {
    return Integer.parseInt(value);
} catch (NumberFormatException e) {
    throw new IllegalArgumentException("invalid boolean value : " + value);
inttoInteger(String value)
Converts a given string into type integer.
if (isInteger(value)) {
    return Integer.parseInt(value);
return -1;
IntegertoInteger(String value)
to Integer
if (null == value) {
    return null;
value = value.trim();
if ("null".equals(value)) {
    return null;
Double d = Double.parseDouble(value);
...
IntegertoInteger(String value)
to Integer
Integer integer = null;
try {
    integer = Integer.parseInt(value);
} catch (Exception e) {
    integer = null;
return integer;
inttoInteger(String value, int _default)
INTERNAL: Casts string to int value, returns default if it fails.
try {
    return Integer.parseInt(value);
} catch (NumberFormatException e) {
    return _default;