큐범
Just do debug
큐범
전체 방문자
오늘
어제
  • 전체보기 (128)
    • 회고 (4)
    • JAVA (16)
      • JAVA 기초 (18)
      • JAVA Algorithm, Datastruct (13)
    • Spring (11)
    • Micro Service Architecture (3)
    • JPA (6)
    • gRPC (4)
    • Network (8)
    • Process (7)
    • Cloud (4)
    • Python (10)
    • Web(vue) (2)
    • UMC (1)
    • DB (9)
    • CS (1)
    • Clean Code (1)
    • TDD (9)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

인기 글

최근 댓글

최근 글

hELLO · Designed By 정상우.
큐범

Just do debug

JAVA/JAVA Algorithm, Datastruct

[Algorithm] JAVA 코드업 기초 100제 (기초-비트단위논리연산) 1059 ~ 1062

2022. 9. 2. 03:10

비트단위(bitwise)연산자

~(bitwise not)

&(bitwise and)

|(bitwise or)

^(bitwise xor)

<<(bitwise left shift)

>>(bitwise right shift)

 

1059 : [기초-비트단위논리연산] 비트단위로 NOT 하여 출력하기(설명)

public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		
		System.out.printf("%d",~s);
	}

1060 : [기초-비트단위논리연산] 비트단위로 AND 하여 출력하기(설명)

public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String[] data = s.split(" ");
		
		System.out.println(Integer.valueOf(data[0])&Integer.valueOf(data[1]));
	}

1061 : [기초-비트단위논리연산] 비트단위로 OR 하여 출력하기(설명)

public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String[] data = s.split(" ");
		
		System.out.println(Integer.valueOf(data[0]) | Integer.valueOf(data[1]));
	}

1062 : [기초-비트단위논리연산] 비트단위로 XOR 하여 출력하기(설명)

public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String[] data = s.split(" ");
		
		System.out.println(Integer.valueOf(data[0]) ^ Integer.valueOf(data[1]));
	}
    'JAVA/JAVA Algorithm, Datastruct' 카테고리의 다른 글
    • [Algorithm] JAVA 코드업 기초 100제 (기초-반복실행구조) 1071 ~ 1077
    • [Algorithm] JAVA 코드업 기초 100제 (기초-삼항연산, 선택실행 구조) 1063 ~ 1070
    • [Algorithm] JAVA 코드업 기초 100제 (기초-논리연산) 1053 ~ 1058
    • [Algorithm] JAVA 코드업 기초 100제 (기초-비교연산) 1049 ~ 1052
    큐범
    큐범

    티스토리툴바