Java Integer to Byte Array intToBytes(byte[] bytes, int index, int value)

Here you can find the source of intToBytes(byte[] bytes, int index, int value)

Description

int To Bytes

License

Open Source License

Declaration

public static void intToBytes(byte[] bytes, int index, int value) 

Method Source Code

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

public class Main {
    public static void intToBytes(byte[] bytes, int index, int value) {
        for (int j = 3; j >= 0; j--) {
            bytes[index + j] = (byte) (value & 0xff);
            value >>>= 8;/*from   w  w  w  . j av  a 2 s .c  om*/
        }
    }
}

Related

  1. intToByteArrayBE(int data)
  2. intToByteArrayLE(int v)
  3. intToByteLittleEnding(int j)
  4. intToByteMSB(int in)
  5. intToBytes(byte[] arr, int offset, int num)
  6. intToBytes(final int aInt)
  7. intToBytes(final int i)
  8. intToBytes(final int integer, final int bLength)
  9. intToBytes(final int number)