Here you can find the source of writeCDouble(ByteBuffer buffer, double value)
public static void writeCDouble(ByteBuffer buffer, double value)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { public static void writeCDouble(ByteBuffer buffer, double value) { writeCLong(buffer, Double.doubleToLongBits(value)); }/*from w w w.j a v a 2 s . co m*/ public static void writeCLong(ByteBuffer buffer, long anInt) { // -128 = short byte, -127 == 4 byte if (anInt > -126 && anInt <= 127) { buffer.put((byte) anInt); } else if (anInt >= Short.MIN_VALUE && anInt <= Short.MAX_VALUE) { buffer.put((byte) -128); buffer.putShort((short) anInt); } else if (anInt >= Integer.MIN_VALUE && anInt <= Integer.MAX_VALUE) { buffer.put((byte) -127); buffer.putInt((int) anInt); } else { buffer.put((byte) -126); buffer.putLong(anInt); } } }