Android Int to Byte Array Convert int2ByteArray(int num)

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

Description

int Byte Array

License

Open Source License

Declaration

public static byte[] int2ByteArray(int num) 

Method Source Code

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

public class Main {

    public static byte[] int2ByteArray(int num) {
        byte[] b = new byte[4];
        b[0] = (byte) (num >>> 24);
        b[1] = (byte) (num >>> 16);
        b[2] = (byte) (num >>> 8);
        b[3] = (byte) num;
        return b;
    }//  w  w w .jav a2 s  .  c  om
}

Related

  1. ints2bytesLE(int[] val)
  2. intsToBytes(int[] values)
  3. getAs_uint16_NetOrder(int theNumber)
  4. getAs_uint32_NetOrder(int theNumber)
  5. toBytes(int integer, byte[] output, int offset)
  6. int2ByteArrayBigEndian(int num)
  7. int2ByteArrayLittleEndian(int num)