Here you can find the source of int2Bytes(int num)
Parameter | Description |
---|---|
num | a parameter |
static byte[] int2Bytes(int num)
//package com.java2s; //License from project: Apache License public class Main { /**// w w w. j a va2 s . c o m * Big Endian * * @param num * @return */ static byte[] int2Bytes(int num) { byte[] bytes = new byte[4]; for (int i = 0; i < 4; i++) { bytes[3 - i] = (byte) (num >>> 8 * i); } return bytes; } }