Last active
December 30, 2015 03:19
-
-
Save XJTU-USTC/7768866 to your computer and use it in GitHub Desktop.
将byte类型值转换为8位的二进制字符串
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static String byte2bits(byte b) { | |
| int z = b; | |
| z |= 256; | |
| String str = Integer.toBinaryString(z); | |
| int len = str.length(); | |
| return str.substring(len-8, len); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment