Over a million developers have joined DZone.
Silver Partner

Convert an Int to a Byte Array

Convert an int into a byte array with this short code snippet.

· Java Zone

    public static byte[] intToByteArray(int value) {
        byte[] b = new byte[4];
        for (int i = 0; i >> offset) & 0xFF);
        }
        return b;
    }


Topics:
java

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}