Here you can find the source of intToByteArray(int i)
Parameter | Description |
---|---|
i | the integer |
public static final byte[] intToByteArray(int i)
//package com.java2s; //License from project: Open Source License public class Main { /**// www.j a v a 2s . c o m * Convert from one int to a byte array * * @param i the integer */ public static final byte[] intToByteArray(int i) { return new byte[] { (byte) (i >> 24), (byte) (i >> 16), (byte) (i >> 8), (byte) i }; } }