Here you can find the source of toByteArray(byte b)
public static byte[] toByteArray(byte b)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] toByteArray(byte b) { byte[] array = new byte[1]; array[0] = b;//from w w w. j ava 2s .c o m return array; } 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; } }