if (study)/Java & Kotlin
검색결과
16
개

[Java] Byte 값을 비트 단위로 출력하기 (이진수로 출력하기)
1. 비트연산자 활용하기 public class ByteToStrTest { public static void main(String[] args) { System.out.println(bytesToBinaryString((byte) 2)); System.out.println(bytesToBinaryString((byte) 30)); System.out.println(bytesToBinaryString((byte) 0x80)); } static String bytesToBinaryString(Byte b) { StringBuilder builder = new StringBuilder(); for (int i = 0; i >> i) & b) ==..
if (study)/Java & Kotlin
2019. 10. 11. 22:51