Here you can find the source of int2byte(final int i)
Parameter | Description |
---|---|
i | int |
public static byte[] int2byte(final int i)
//package com.java2s; public class Main { /**/* w w w.jav a2 s .c o m*/ * Convert int to byte[4] * * @param i * int * @return byte[4] */ public static byte[] int2byte(final int i) { final byte[] arr = new byte[4]; arr[0] = (byte) i; arr[1] = (byte) (i >>> 8); arr[2] = (byte) (i >>> 16); arr[3] = (byte) (i >>> 24); return arr; } }