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(byte[] si)
Convert a byte[] (most significant byte first) to the corresponding int value.
return toInt(si, false);
int[]toInt(byte[] src)
Convert an array of byte 's into an array of int '.
int number = src.length;
int[] dst = new int[number];
for (int j = 0; j < number; ++j) {
    dst[j] = (int) src[j];
return dst;
inttoInt(byte[] src)
Converts a given byte array to an integer.
return readInt(src, 0);
inttoInt(byte[] src, int srcPos)
to Int
int dword = 0;
for (int i = 0; i < 4; i++) {
    dword = (dword << 8) + (src[i + srcPos] & 0xFF);
return dword;
inttoInt(byte[] value)
Converte um texto representado por um arranjo de bytes em um inteiro.
int limit = value.length - 1;
byte signal = value[0] == NEGATIVE ? FALSE : TRUE;
byte hasSignal = value[0] == NEGATIVE || value[0] == POSITIVE ? TRUE : FALSE;
int start = hasSignal == TRUE ? 1 : 0;
int result = 0;
int mult = 1;
for (int i = limit; i >= start; i--) {
    int tmp = value[i] - ZERO;
...
inttoInt(byte[] value)
to Int
return toInt(value, 0);
inttoInt(char msc, char lsc)
joining 2 chars to form an int
return ((msc << 16) | lsc);
inttoInt(char[] bytes, boolean le)
to Int
if (bytes.length != 8)
    return 0;
return (int) Long.parseLong(bytesToString(bytes, le, true), 16);
inttoInt(double d)
Rounds the double to the nearest integer.
if (d > 0)
    d += 0.5;
else if (d < 0)
    d -= 0.5;
return (new Double(d)).intValue();
inttoInt(double d)
Cast double values into integer.
if (d > Integer.MAX_VALUE || d < Integer.MIN_VALUE) {
    throw new IllegalArgumentException("Value out of int range - " + d);
return (int) d;