How can I convert double to byte array in Java? I looked at many other posts, but couldn\'t figure out the right way.
Input = 65.43 byte[] size = 6 precisi
public static byte[] encode(double input, int size, int precision) { double tempInput = input; for (int i = 0; i < precision; i++) tempInput *= 10; int output = (int) tempInput; String strOut = String.format("%0"+size+"d", output); return strOut.getBytes(); }