将有符号字节转换为“无符号”存储到Harddrive等的字节 [英] Converting Signed byte to "unsigned" byte for storing to Harddrive etc
本文介绍了将有符号字节转换为“无符号”存储到Harddrive等的字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
让我们说我正在使用一种文件格式,从0-255获取一些输入的字节。在Java中,使用allways signed byte有点难。
如何将int转换为byte并获得正确的二进制值?
Lets say i am working with a file format that takes bytes from 0-255 for some input. In Java, that is a bit hard with the allways signed byte.
How do i convert a int to byte and get the correct binary value?
推荐答案
将int转换为字节,
http://stackoverflow.com/questions/842817/how-does-java-convert-int-into-byte [ ^ ]
将字节转换为二进制值,
http://stackoverflow.com/questions/11528898/convert-byte-to-binary-in-java [ ^ ]
希望有所帮助,
Converting an int to a byte,
http://stackoverflow.com/questions/842817/how-does-java-convert-int-into-byte[^]
Converting a byte to binary value,
http://stackoverflow.com/questions/11528898/convert-byte-to-binary-in-java[^]
Hope that helps,
这篇关于将有符号字节转换为“无符号”存储到Harddrive等的字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文