Integer.toBinaryString( int i ); return : String int a = 30; String b = Integer.toBinaryString( a ); a : 30 b : 0001 1110 Integer.parseInt( String s , int n์ง์ ); return : int String s = Integer.toBinaryString( a ); // 0001 1110 int i = Integer.parseInt( s , 2 ); s : 0001 1110 i : 30
101010101011 0์ผ๋ก. | ์ฐ์ฐ์ // |์ฐ์ฐ์ ( or ) int a = 7; int b = 15; int c = a | b; a : 0111 b : 1111 ----or์ฐ์ฐ----- c : 1111 or ์ฐ์ฐ์ด๋ผ๊ณ ์๊ฐํ๋ฉด ๋๋ค. ๋์ค ํ๋๋ผ๋ 1์ด๋ฉด 1์ด๋ค. ( 1 or 0 = 1, 0 or 1 = 1 ) &์ฐ์ฐ์ // &์ฐ์ฐ์(and) int a = 7; int b = 15; int c = a&b; a : 0111 b : 1111 ----&์ฐ์ฐ------ c : 0111 and ์ฐ์ฐ์ด๋ค. ๋ ๋ค 1์ด๋ฉด ๊ฒฐ๊ณผ๊ฐ์ด 1์ด๋ค. ( 1 and 0 = 0 , 1 and 1 = 1) ^์ฐ์ฐ์ // ^์ฐ์ฐ์( XOR ) int a = 7; int b = 15; int c = a ^ b; a : 0111..