Skip to content

Commit c13bc21

Browse files
修改示例
1 parent fd070fb commit c13bc21

File tree

5 files changed

+64
-28
lines changed

5 files changed

+64
-28
lines changed

src/main/java/com/bit/BitDemo.java

+13-14
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public class BitDemo {
3131
* 某一个数x, x & 1 可以得到 x 除以 2 的余数。也就是说,可以用 x & 1 来判断奇偶数。
3232
*
3333
*/
34-
public static void andDemo(int num1, int num2) {
35-
int result = num1 & num2;
34+
public static void andDemo() {
35+
int result = 8 & 7;
3636
System.out.println(result);
3737

3838
}
@@ -48,9 +48,10 @@ public static void andDemo(int num1, int num2) {
4848
* 结果:
4949
* 1111
5050
*
51+
* 1111转化为十进制是15,也就是说 8 | 7 = 15.
5152
*/
52-
public static void orDemo(int num1, int num2) {
53-
int result = num1 | num2;
53+
public static void orDemo() {
54+
int result = 8 | 7;
5455
System.out.println(result);
5556

5657
}
@@ -59,11 +60,9 @@ public static void orDemo(int num1, int num2) {
5960
/**
6061
* 异或 a ^ b 相同为0,相异为1
6162
*
62-
* @param num1
63-
* @param num2
6463
*/
65-
public static void xorDemo(int num1, int num2) {
66-
int result = num1 ^ num2;
64+
public static void xorDemo() {
65+
int result = 5 ^ 10;
6766
System.out.println(result);
6867

6968
}
@@ -73,8 +72,8 @@ public static void xorDemo(int num1, int num2) {
7372
* ~ 取反 ~a 0的为1,1的为0
7473
*
7574
*/
76-
public static void reverseDemo(int num) {
77-
int result = ~num;
75+
public static void reverseDemo() {
76+
int result = ~5;
7877
System.out.println(result);
7978
}
8079

@@ -83,8 +82,8 @@ public static void reverseDemo(int num) {
8382
* 左移一位,相当于乘以2。
8483
*
8584
*/
86-
public static void leftDemo(int num) {
87-
int result = num << 1;
85+
public static void leftDemo() {
86+
int result = 7 << 1;
8887
System.out.println(result);
8988
}
9089

@@ -93,8 +92,8 @@ public static void leftDemo(int num) {
9392
* 右移一位,相当于除以2。
9493
*
9594
*/
96-
public static void rightDemo(int num) {
97-
int result = num >> 1;
95+
public static void rightDemo() {
96+
int result = 8 >> 1;
9897
System.out.println(result);
9998
}
10099

src/main/java/com/test/Test.java

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
package com.test;
22

3+
import com.alibaba.druid.sql.visitor.functions.Char;
34
import lombok.extern.java.Log;
45
import lombok.extern.log4j.Log4j;
56

67
import java.util.ArrayList;
78
import java.util.List;
9+
import java.util.Scanner;
810

9-
/**
10-
* Created by lenovo on 三月
11-
*/
1211
@Log
1312
public class Test {
1413
public static void main(String[] args) {
15-
List<String> list=new ArrayList<String>();
16-
list.add("17875421001");
17-
list.add("12372221098");
18-
log.info("test");
19-
14+
Scanner in=new Scanner(System.in);
15+
StringBuilder stars=new StringBuilder();
16+
StringBuilder sb=new StringBuilder();
17+
while (in.hasNext()) {
18+
String input=in.next();
19+
for(char c:input.toCharArray()){
20+
if ('*'==c){
21+
stars.append("*");
22+
}else {
23+
sb.append(c);
24+
}
25+
}
26+
}
27+
System.out.println(stars.toString()+sb.toString());
2028
}
2129
}

src/main/java/com/test/Test2.java

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.test;
2+
3+
4+
import java.util.Scanner;
5+
6+
public class Test2 {
7+
public static void main(String[] args) {
8+
Scanner sc = new Scanner(System.in);
9+
int n = sc.nextInt();
10+
int ans = 0;
11+
int x;
12+
for(int i = 0; i < n; i++){
13+
for(int j = 0; j < n; j++){
14+
x = sc.nextInt();
15+
16+
}
17+
}
18+
System.out.println(ans);
19+
}
20+
}

src/main/java/com/test/Test3.java

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.test;
2+
3+
/**
4+
* @Author: EnjoyCoding
5+
* @Date: 2020\6\7 0007 15:19
6+
* @Description:
7+
*/
8+
public class Test3 {
9+
}

src/main/java/test/com/bit/BitDemoTest.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void after() throws Exception {
3030
@Test
3131
public void testAndDemo() throws Exception {
3232
//TODO: Test goes here...
33-
BitDemo.andDemo(8, 7);
33+
BitDemo.andDemo();
3434
}
3535

3636
/**
@@ -41,7 +41,7 @@ public void testAndDemo() throws Exception {
4141
@Test
4242
public void testOrDemo() throws Exception {
4343
//TODO: Test goes here...
44-
BitDemo.orDemo(8, 7);
44+
BitDemo.orDemo();
4545
}
4646

4747
/**
@@ -52,7 +52,7 @@ public void testOrDemo() throws Exception {
5252
@Test
5353
public void testXorDemo() throws Exception {
5454
//TODO: Test goes here...
55-
BitDemo.xorDemo(8, 7);
55+
BitDemo.xorDemo();
5656
}
5757

5858
/**
@@ -63,7 +63,7 @@ public void testXorDemo() throws Exception {
6363
@Test
6464
public void testReverseDemo() throws Exception {
6565
//TODO: Test goes here...
66-
BitDemo.reverseDemo(5);
66+
BitDemo.reverseDemo();
6767
}
6868

6969
/**
@@ -74,7 +74,7 @@ public void testReverseDemo() throws Exception {
7474
@Test
7575
public void testLeftDemo() throws Exception {
7676
//TODO: Test goes here...
77-
BitDemo.leftDemo(10);
77+
BitDemo.leftDemo();
7878
}
7979

8080
/**
@@ -85,7 +85,7 @@ public void testLeftDemo() throws Exception {
8585
@Test
8686
public void testRightDemo() throws Exception {
8787
//TODO: Test goes here...
88-
BitDemo.rightDemo(20);
88+
BitDemo.rightDemo();
8989
}
9090

9191

0 commit comments

Comments
 (0)