Java Integer to Byte int2ByteArray(int value)

Here you can find the source of int2ByteArray(int value)

Description

int Byte Array

License

Apache License

Declaration

public static byte[] int2ByteArray(int value) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static byte[] int2ByteArray(int value) {
        byte[] b = new byte[4];
        for (int i = 0; i < 4; i++) {
            int offset = (3 - i) * 8;
            b[i] = (byte) ((value >>> offset) & 0xFF);
        }/*from  w w  w. j  av  a 2s.c  o  m*/
        return b;
    }
}

Related

  1. int2byte(int ival, byte b[], int offset)
  2. int2byte(int value)
  3. int2byte(int[] ia)
  4. int2ByteArray(int i)
  5. int2byteArray(int k, byte b[], int off)
  6. int2byteArray(int[] i)
  7. int2ByteArrayLength4(int theInt)
  8. int2ToByteArray(int value)
  9. int2ubyte(int in)