java.nio.BufferUnderflowException 同时将字节数组转换为双精度数组
2022-09-03 06:22:14
我需要将字节数组转换为双精度。我正在使用
double dvalue = ByteBuffer.wrap(value).getDouble();
但是在运行时,我得到了BufferUnderflowException异常
Exception in thread "main" java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:498)
at java.nio.HeapByteBuffer.getDouble(HeapByteBuffer.java:508)
at Myclass.main(Myclass.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
我需要在此处更改哪些内容?