public static byte[] toByteArray(int i) {
        byte[] array = new byte[4];

        array[3] = (byte) (i & 0xFF);
        array[2] = (byte) ((i >> 8) & 0xFF);
        array[1] = (byte) ((i >> 16) & 0xFF);
        array[0] = (byte) ((i >> 24) & 0xFF);

        return array;
    }
Clone of Android's /core/java/com/android/internal/util/HexDump class, for use in debugging.
Changes: space separated hex strings
usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/util/HexDump.java