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

int[]toIntArray(double[] array)
Converts a double array to an int array
int[] out = new int[array.length];
for (int i = 0; i < out.length; i++)
    out[i] = (int) Math.round(array[i]);
return out;
int[]toIntArray(final byte[] array)
to Int Array
return toIntArray(array, 0, array.length);
int[]toIntArray(final byte[] bytes)
to Int Array
int len = bytes.length;
int[] arr = new int[len];
for (int i = 0; i < len; i++)
    arr[i] = (int) bytes[i];
return arr;
int[]toIntArray(final double[] doubleArray)
to Int Array
int[] dataToInt = null;
if (doubleArray != null) {
    dataToInt = new int[doubleArray.length];
    for (int i = 0; i < doubleArray.length; i++) {
        dataToInt[i] = (int) Math.round(doubleArray[i]);
return dataToInt;
...
int[]toIntArray(final int ip)
Convert a packed integer IPv4 address into a 4-element array.
final int[] ret = new int[IPV4_PARTS];
for (int j = 3; j >= 0; --j) {
    ret[j] |= ip >>> 8 * (3 - j) & 0xff;
return ret;
int[]toIntArray(final Object[] array)
to Int Array
if (array == null) {
    return new int[0];
final int[] retVal = new int[array.length];
try {
    for (int i = 0; i < array.length; i++) {
        retVal[i] = Integer.parseInt(String.valueOf(array[i]));
    return retVal;
} catch (Exception e) {
    return new int[0];
int[]toIntArray(final String[] arrayOfIntStrings)
Takes an array of Strings and will convert it to an array of ints The Strings MUST be string representations of numbers, otherwise the behavior will be undefined
int[] result = new int[arrayOfIntStrings.length];
for (int i = 0; i < arrayOfIntStrings.length; i++) {
    result[i] = Integer.valueOf(arrayOfIntStrings[i]).intValue();
return result;
int[]toIntArray(int... values)
to Int Array
int[] array = new int[values.length];
System.arraycopy(values, 0, array, 0, values.length);
return array;
int[]toIntArray(Integer[] data)
to Int Array
int[] r = new int[data.length];
for (int i = 0; i < data.length; i++)
    r[i] = data[i].intValue();
return r;
int[]toIntArray(Integer[] objArray)
Integer conversion
int length = objArray.length;
int[] retValue = new int[length];
for (int i = 0; i < length; i++) {
    retValue[i] = objArray[i];
return retValue;