From 836de8f63356efecf2a5c201c74d7cc4b3039e0c Mon Sep 17 00:00:00 2001 From: 30980 <309804010@qq.com> Date: Tue, 23 Aug 2022 22:09:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=8D=E8=BF=90=E7=AE=97=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E8=8A=82=E8=AF=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/never/BitOperation.java | 23 ++++++++++++++++++++ target/classes/com/never/BitOperation.class | Bin 0 -> 910 bytes 2 files changed, 23 insertions(+) create mode 100644 src/main/java/com/never/BitOperation.java create mode 100644 target/classes/com/never/BitOperation.class diff --git a/src/main/java/com/never/BitOperation.java b/src/main/java/com/never/BitOperation.java new file mode 100644 index 0000000..05f6b50 --- /dev/null +++ b/src/main/java/com/never/BitOperation.java @@ -0,0 +1,23 @@ +package com.never; + +public class BitOperation { + public static void main(String[] args) { + int a = 2 ; + int b = ~a+1; + int c = b>>2; + int d = b>>>2; + printBit(a); + printBit(b); + System.out.println(b); + printBit(c); + printBit(d); + System.out.println(c); + System.out.println(d); + } + private static void printBit(int num){ + for(int i = 31; i >= 0; i--){ + System.out.print((num & (1<1nj~lCQZjC`8ImgYW zn|@dJ+cHqvK5-i1Gj$*^(>%T1I`IZlvF(!cWYR!1L9$m~uU>64E`uHs3a5kxgrsa! zI+QMDm!dclZ^*%9TA}Pde<1fy$fR5TFzCAXm8LuO@7P!MTyUOW6yxUtac}}i@LZr( zqZZWW$}z+zUSe3}slz&TiKjhDAjAb)DO|)dJ^Jx6vrXzdW}_T?YdpPMF<)&~%-1)K z@)uYY%4cLMBNXO&EgBPho;KY@gZgj58!ST>1Wb^rMJvgrNTG-{X1P{N^eiKTDpzI= zS=>f0BDXOifJ?Z{_c7eU6*#1q#5!{wdTd1T(ij!pu7{J{tdEXoQL;9gn6|ii+n+w}1-roKKPPrHELGpgQXs jJwn5ihC{tdnS=2QanZ6cJ!UW_D7=fGq%HU*x{