Skip to content

Commit 30a5eac

Browse files
committed
[add] add module java-container and update README.
1 parent 0616b6e commit 30a5eac

File tree

4 files changed

+36
-3
lines changed

4 files changed

+36
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
**点击相应的模块能看到每个目录的说明文档**
1717

1818
- [blogs](/blogs):博客文档
19-
- [java-base](/java-base):java基础巩固模块的 java 源码
19+
- [java-base](/java-base):java 基础巩固模块的 java 源码
2020
- [java-multithread](/java-multithread):多线程模块的 java 源码
2121

2222

@@ -60,8 +60,8 @@
6060
* [x] 整理成 maven 的结构,使用聚合和继承特性(2016.4.12完成)
6161
* [ ] 原有的 javase 部分代码重构为 java-base 模块,并逐步上传代码
6262
* [x] 多线程部分使用 java-multithread 模块(2016.4.17完成)
63-
* [ ] 集合类部分使用模块 java-collections
64-
* [ ] IO部分使用模块java-io
63+
* [ ] 容器类部分使用模块 java-container
64+
* [ ] IO 部分使用模块 java-io
6565
* [ ] java虚拟机相关部分使用模块 java-jvm
6666
* [ ] java 8 新特性使用模块 java8
6767

java-base/src/main/java/com/brianway/learning/java/base/Binary.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,29 @@
44
* Created by brian on 16/11/10.
55
*
66
* TODO 补码/反码相关知识
7+
* https://www.cnblogs.com/zhangziqiu/archive/2011/03/30/ComputerCode.html
8+
* http://weihe6666.iteye.com/blog/1190033
9+
*
10+
* 在计算机中,负数以原码的补码形式表达。
711
*/
812
public class Binary {
913
public static void main(String[] args) {
1014
int i = 5;
1115
int j = 10;
1216
System.out.println(i + ~j);
17+
18+
int[] arr = new int[] {3, -2};
19+
for (int a : arr) {
20+
//原数
21+
System.out.println("a:" + a + " 二进制:" + Integer.toBinaryString(a));
22+
// 按位取反
23+
System.out.println("~a:" + ~a + " 二进制:" + Integer.toBinaryString(~a));
24+
// 相反数
25+
System.out.println("-a:" + -a + " 二进制:" + Integer.toBinaryString(-a));
26+
27+
System.out.println(-a == ~a + 1);
28+
System.out.println(~a == -a - 1);
29+
}
30+
1331
}
1432
}

java-container/pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>java-learning</artifactId>
7+
<groupId>com.brianway.learning.java</groupId>
8+
<version>1.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>java-container</artifactId>
13+
14+
</project>

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
<modules>
4747
<module>java-multithread</module>
4848
<module>java-base</module>
49+
<module>java-container</module>
4950
</modules>
5051

5152
<dependencyManagement>

0 commit comments

Comments
 (0)