Java DoubleBuffer convert from ByteBuffer
import java.nio.ByteBuffer; import java.nio.DoubleBuffer; public class Main { public static void main(String[] args) { ByteBuffer bb = ByteBuffer.wrap(new byte[] { 0, 0, 0, 0, 0, 0, 0, 'a' }); bb.rewind();/* w w w .j a v a2s. c o m*/ System.out.println("Byte Buffer"); while (bb.hasRemaining()) System.out.println(bb.position() + " -> " + bb.get()); DoubleBuffer db = ((ByteBuffer) bb.rewind()).asDoubleBuffer(); System.out.println("Double Buffer"); while (db.hasRemaining()) System.out.println(db.position() + " -> " + db.get()); } }