Here you can find the source of toDouble(ByteBuffer buffer)
public static double toDouble(ByteBuffer buffer)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { public static double toDouble(byte[] bytes) { return toDouble(ByteBuffer.wrap(bytes)); }//from ww w .j a va 2 s. c o m public static double toDouble(ByteBuffer buffer) { return toByteBuffer(buffer, Double.BYTES).getDouble(); } protected static ByteBuffer toByteBuffer(ByteBuffer buffer, int length) { if (length > buffer.remaining()) { return (ByteBuffer) ((ByteBuffer) ByteBuffer.allocate(length).position(length - buffer.remaining())) .put(buffer.array()).rewind(); } else { return buffer; } } }