Android Byte Array Encode putInts(int[] fromInts, byte[] toBytes)

Here you can find the source of putInts(int[] fromInts, byte[] toBytes)

Description

put Ints

License

Open Source License

Declaration

public static void putInts(int[] fromInts, byte[] toBytes) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static final int INT_SIZE = 4;

    public static void putInts(int[] fromInts, byte[] toBytes) {
        for (int intInd = 0; intInd < fromInts.length; ++intInd) {
            putInt(fromInts[intInd], intInd * INT_SIZE, toBytes);
        }//ww  w .  java2s .c om
    }

    public static void putInt(int value, int offset, byte[] byteArr) {
        byteArr[offset + 0] = (byte) (value >>> 24);
        byteArr[offset + 1] = (byte) (value >>> 16);
        byteArr[offset + 2] = (byte) (value >>> 8);
        byteArr[offset + 3] = (byte) (value >>> 0);
    }
}

Related

  1. encode3to4(byte[] b4, byte[] threeBytes, int numSigBytes, int options)
  2. encode3to4(byte[] source, int srcOffset, int numSigBytes, byte[] destination, int destOffset, int options)
  3. putChar(byte[] bb, char ch, int index)
  4. putDouble(byte[] bb, double x, int index)
  5. putInt(int value, int offset, byte[] byteArr)
  6. putLong(byte[] bb, long x, int index)
  7. putOrCopyString(String fromString, byte[] toBytes)
  8. putReverseBytesInt(byte[] bb, int x, int index)
  9. putReverseBytesLong(byte[] bb, long x, int index)