Java Utililty Methods Integer to

List of utility methods to do Integer to

Description

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

Method

byte[]intToNumericFormat(int src)
Converts the internal integer representation of an IPv4 into a binary address.
byte[] addr = new byte[INADDRSZ];
addr[0] = (byte) ((src >>> 24) & 0xFF);
addr[1] = (byte) ((src >>> 16) & 0xFF);
addr[2] = (byte) ((src >>> 8) & 0xFF);
addr[3] = (byte) (src & 0xFF);
return addr;
StringintToOctal(int value)
int To Octal
String octString = Integer.toOctalString(value);
return octString;
StringIntToOctString(final int value)
Int To Oct String
final String string = Integer.toString(value, 8).toUpperCase();
if (string.charAt(0) == '-') {
    return "-0" + string.substring(1, string.length());
} else {
    return "0" + string;
byte[]intToOneByte(int i)
int To One Byte
byte[] b = new byte[1];
b[0] = (byte) (i & 0xff);
return b;
byteintToOneByte(int value)
int To One Byte
if ((value < 0) || (value > MAX_8BITS))
    throw new IllegalArgumentException(String.format(ERR_VALUE_OOB, value));
return (byte) (value & 0xFF);
byte[]intToOneByteArray(int number)
Returns the int as a byte array with just one entry.
return new byte[] { intToByte(number) };
charIntToPackage(int pack)
get an int into char depending on the package it represent
char iPack;
pack = pack + 65;
iPack = (char) pack;
if (pack >= 65 && pack <= 90)
    return iPack;
else
    return '#';
StringintToPaddedString(int value, int pad)
int To Padded String
StringBuilder sb = new StringBuilder();
sb.append(value);
int padding = pad - sb.length();
if (padding > 0) {
    sb.insert(0, PADDING.subSequence(0, padding));
return sb.toString();
StringintToPercent(int value)
int To Percent
StringBuilder buffer = new StringBuilder();
int highValue = value / 100;
int lowValue = value % 100;
buffer.append(highValue).append('.');
if (lowValue < 10)
    buffer.append('0');
buffer.append(lowValue);
return buffer.toString();
...
StringintToPlusMin(int i)
int To Plus Min
switch (i) {
case 0:
    return "\u00A74-2";
case 1:
    return "\u00A74-1";
case 2:
    return "\u00A770";
case 3:
...