Java Utililty Methods Integer Array Convert To

List of utility methods to do Integer Array Convert To

Description

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

Method

StringintArrayToIp(final int[] array, final int offset)
int Array To Ip
String returnValue = String.valueOf(array[offset]) + "." + String.valueOf(array[offset + 1]) + "."
        + String.valueOf(array[offset + 2]) + "." + String.valueOf(array[offset + 3]);
return returnValue;
byteintsToByteHighAndLow(int highValue, int lowValue)
ints To Byte High And Low
return (byte) ((highValue << 4 | lowValue) & 0xFF);
voidintsToBytes(byte[] dst, int dst_offset, int[] src, int src_offset, int length)
Convert an array of ints into an array of bytes.
if ((src == null) || (dst == null) || ((dst_offset + length) > dst.length)
        || ((src_offset + length) > (src.length * 4)) || ((src_offset % 4) != 0) || ((length % 4) != 0)) {
    croak("intsToBytes parameters are invalid:" + " src=" + src + " dst=" + dst + " (dst_offset="
            + dst_offset + " + length=" + length + ")=" + (dst_offset + length) + " > dst.length="
            + ((dst == null) ? 0 : dst.length) + " (src_offset=" + src_offset + " + length=" + length + ")="
            + (src_offset + length) + " > (src.length=" + ((src == null) ? 0 : src.length) + "*4)="
            + ((src == null) ? 0 : (src.length * 4)) + " (src_offset=" + src_offset + " % 4)="
            + (src_offset % 4) + " != 0" + " (length=" + length + " % 4)=" + (length % 4) + " != 0");
...
voidintsToBytes(int[] a, int aoffset, int len, byte[] b, int boffset)
ints To Bytes
for (int i = 0; i < len; ++i)
    intToBytes(a[aoffset + i], b, boffset + (i << 2));
byte[]intsToBytes(int[] data)
Convert an array of integers into a new array of bytes.
byte[] b = new byte[data.length * 4];
for (int i = 0; i < data.length; i++) {
    b[i * 4] = (byte) (data[i] & 0xFF);
    b[i * 4 + 1] = (byte) ((data[i] >> 8) & 0xFF);
    b[i * 4 + 2] = (byte) ((data[i] >> 16) & 0xFF);
    b[i * 4 + 3] = (byte) ((data[i] >> 24) & 0xFF);
return b;
...
Byte[]intsToBytes(int[] intArray)
ints To Bytes
Byte[] byteArray = new Byte[intArray.length];
for (int i = 0; i < intArray.length; i++) {
    byteArray[i] = (byte) intArray[i];
return byteArray;
byte[][]intsToBytes(int[][] ints)
ints To Bytes
byte[][] bytes = new byte[ints.length][];
for (int a = 0; a < ints.length; a++) {
    int[] is = ints[a];
    byte[] bs = new byte[is.length];
    bytes[a] = bs;
    for (int i = 0; i < is.length; i++) {
        int v = is[i];
        if (v < 0)
...
StringintsToCommaSeparatedString(int[] ints)
ints To Comma Separated String
StringBuilder sb = new StringBuilder(ints.length * 5 + ints.length);
for (int i = 0; i < ints.length; i++) {
    sb.append(ints[i]).append(',');
return sb.toString();
String[]intsToHex(int[] val)
ints To Hex
if (val == null || val.length == 0)
    return EMPTY_STRING_ARRAY;
String[] ss = new String[val.length];
for (int i = 0; i < ss.length; i++) {
    ss[i] = intToHex(val[i]);
return ss;
Integer[]intsToIntegers(int... ints)
Converts an array of ints to an array of Integers.
Integer[] integers = new Integer[ints.length];
for (int index = 0; index < ints.length; ++index) {
    integers[index] = Integer.valueOf(ints[index]);
return integers;