Here you can find the source of intToBytes(int i)
Parameter | Description |
---|---|
i | Integer to split |
private static byte[] intToBytes(int i)
//package com.java2s; //License from project: Creative Commons License public class Main { /**/*from ww w. j ava2s . c o m*/ * Spilts an int into 4 bytes * @param i Integer to split * @return 4-byte array, 0th byte being the first byte in an integer */ private static byte[] intToBytes(int i) { return new byte[] { (byte) (i >> 24), (byte) (i >> 16), (byte) (i >> 8), (byte) i }; } }