【发布时间】:2010-02-18 14:48:06
【问题描述】:
这对我来说很奇怪: 当我在 Java 中运行时
byte[] data = new byte[] { 50, -106, 40, -22, -94, -119, -52, 8 };
ByteBuffer bb = ByteBuffer.wrap( data );
System.out.println( bb.getLong() );
结果是 3645145936617393160
当我在 C# 中运行时
//unsigned values (signed&0xff)
byte[] bytes = new byte[] { 50, 150, 40, 234, 162, 137, 204, 8 };
long l = BitConverter.ToInt64(bytes, 0);
System.Console.Write(String.Format("{0}\n", l));
System.Console.ReadKey();
结果是 634032980358633010
你能帮我理解一下吗?
谢谢!
【问题讨论】: