Android Int to Byte Array Convert int2ByteArrayBigEndian(int num)

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

Description

int Byte Array Big Endian

License

Open Source License

Declaration

public static byte[] int2ByteArrayBigEndian(int num) 

Method Source Code

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

public class Main {

    public static byte[] int2ByteArrayBigEndian(int num) {
        return int2ByteArray(num);
    }//w ww. j  a  v a2  s . c  o  m

    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;
    }
}

Related

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