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(final String str, int defaultValue)
Method to convert string to Integer when a default value is given
if (str == null) {
    return defaultValue;
try {
    return Integer.parseInt(str);
} catch (final NumberFormatException exception) {
    return defaultValue;
StringtoInt(final String string)
to Int
if (string == null) {
    return "-1";
return String.valueOf(Integer.parseInt(string));
inttoInt(final String strPriority)
to Int
if (strPriority != null && strPriority.length() != 0) {
    try {
        return Integer.parseInt(strPriority);
    } catch (NumberFormatException e) {
return 0;
inttoInt(final String text, final int defaultValue)
Re-conversion of the textual representation of an Integer .
if (text != null) {
    try {
        return Integer.parseInt(text);
    } catch (final NumberFormatException nfe) {
return defaultValue;
inttoInt(final String value)
To int.
return (int) toLong(value);
inttoInt(float value)
to Int
return (new Float(truncate(value, 0))).intValue();
inttoInt(int byteSignificance, byte b)
to Int
return ((b & 0xFF) << (8 * byteSignificance));
inttoInt(int[] rgb)
to Int
return toInt(rgb[0], rgb[1], rgb[2]);
inttoInt(Integer i)
Transform an Integer to an int (null will be transformed to 0).
int returnValue = 0;
if (i != null) {
    returnValue = i;
return returnValue;
inttoInt(Integer n)
Returns either an n converted to int, or 0 if n equals null
return n != null ? n : 0;