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

intintToPrefixCoded(final int val, final int shift, final char[] buffer)
Expert: Returns prefix coded bits after reducing the precision by shift bits.
if (shift > 31 || shift < 0)
    throw new IllegalArgumentException("Illegal shift value, must be 0..31");
int nChars = (31 - shift) / 7 + 1, len = nChars + 1;
buffer[0] = (char) (SHIFT_START_INT + shift);
int sortableBits = val ^ 0x80000000;
sortableBits >>>= shift;
while (nChars >= 1) {
    buffer[nChars--] = (char) (sortableBits & 0x7f);
...
byte[]intToRegisters(int v)
Converts an int value to a byte[4] array.
byte[] registers = new byte[4];
registers[0] = (byte) (0xff & (v >> 24));
registers[1] = (byte) (0xff & (v >> 16));
registers[2] = (byte) (0xff & (v >> 8));
registers[3] = (byte) (0xff & v);
return registers;
float[]intToRGB(int color)
int To RGB
float[] rgb = new float[3];
long blue = color % 256;
color = color / 256;
long green = color % 256;
color = color / 256;
long red = color % 256;
rgb[0] = red / 255F;
rgb[1] = green / 255F;
...
int[]IntToRGB(int rgbInt)
Converts an RGB integer value into an array of RGB values.
int r = (int) (rgbInt / 256.0 / 256.0 % 256);
int g = (int) (rgbInt / 256.0 % 256);
int b = (int) (rgbInt % 256);
return new int[] { r, g, b };
int[]intToRgbComponents(int rgb)
Convert rgb to its components
return new int[] { rgb >> 16 & 0xFF, rgb >> 8 & 0xFF, rgb & 0xFF };
StringintToRoman(int i)
set command line for Runtime.exec() depending on operation system R_BATCH is set in chg.properties and loaded with programm start R_BATCH contains absolute pathname to batch file inside the batchfile R batch is called
if (i > 50) {
    return intToRoman(i - 50);
String roman = "";
if (i >= 10) {
    for (int j = (int) Math.ceil(i / 10); j > 0; j--) {
        i -= 10;
        roman += "X";
...
StringintToRoman(int value)
int To Roman
if (value <= 0 && value >= 4000) {
    return null;
String romanString = "";
int remainder = value;
for (int i = 0; i < BASIC_VALUES.length; i++) {
    while (remainder >= BASIC_VALUES[i]) {
        romanString += BASIC_ROMAN_NUMBERS[i];
...
StringintToScaleString(final int number, final int scale)
int to scale string
if (number < 0) {
    throw new RuntimeException(String.format("unsupport nagative number:%s", number));
int length = scale <= characters.length ? scale : characters.length;
StringBuilder builder = new StringBuilder();
int num = number;
do {
    int mod = num % length;
...
ShortintToShort(final int value)
int To Short
return (short) value;
intintToSlider(final int min, final int max, final int value)
Converts the integer value to a slider selection.
return doubleToSlider(min, max, value);