import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.FloatBuffer;
public class Buffers {
public static void main(String[] args) {
try {
float[] floats = { 6.61E-39F, 9.918385E-39F};
ByteBuffer bb = ByteBuffer.allocate(floats.length * 4);
FloatBuffer fb = bb.asFloatBuffer();
fb.put(floats);
CharBuffer cb = bb.asCharBuffer();
System.out.println(cb.toString());
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}
|