| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,7 +16,7 @@ | |||
| 16 | 16 | **点击相应的模块能看到每个目录的说明文档** | |
| 17 | 17 | ||
| 18 | 18 | - [blogs](/blogs):博客文档 | |
| 19 | - - [java-base](/java-base):java基础巩固模块的 java 源码 | ||
| 19 | + - [java-base](/java-base):java 基础巩固模块的 java 源码 | ||
| 20 | 20 | - [java-multithread](/java-multithread):多线程模块的 java 源码 | |
| 21 | 21 | ||
| 22 | 22 | ||
@@ -60,8 +60,8 @@ | |||
| 60 | 60 | * [x] 整理成 maven 的结构,使用聚合和继承特性(2016.4.12完成) | |
| 61 | 61 | * [ ] 原有的 javase 部分代码重构为 java-base 模块,并逐步上传代码 | |
| 62 | 62 | * [x] 多线程部分使用 java-multithread 模块(2016.4.17完成) | |
| 63 | - * [ ] 集合类部分使用模块 java-collections | ||
| 64 | - * [ ] IO部分使用模块java-io | ||
| 63 | + * [ ] 容器类部分使用模块 java-container | ||
| 64 | + * [ ] IO 部分使用模块 java-io | ||
| 65 | 65 | * [ ] java虚拟机相关部分使用模块 java-jvm | |
| 66 | 66 | * [ ] java 8 新特性使用模块 java8 | |
| 67 | 67 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,11 +4,29 @@ | |||
| 4 | 4 | * Created by brian on 16/11/10. | |
| 5 | 5 | * | |
| 6 | 6 | * TODO 补码/反码相关知识 | |
| 7 | + * https://www.cnblogs.com/zhangziqiu/archive/2011/03/30/ComputerCode.html | ||
| 8 | + * http://weihe6666.iteye.com/blog/1190033 | ||
| 9 | + * | ||
| 10 | + * 在计算机中,负数以原码的补码形式表达。 | ||
| 7 | 11 | */ | |
| 8 | 12 | public class Binary { | |
| 9 | 13 | public static void main(String[] args) { | |
| 10 | 14 | int i = 5; | |
| 11 | 15 | int j = 10; | |
| 12 | 16 | 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 | + | ||
| 13 | 31 | } | |
| 14 | 32 | } | |
| Original file line number | Diff line number | Diff 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> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,6 +46,7 @@ | |||
| 46 | 46 | <modules> | |
| 47 | 47 | <module>java-multithread</module> | |
| 48 | 48 | <module>java-base</module> | |
| 49 | + <module>java-container</module> | ||
| 49 | 50 | </modules> | |
| 50 | 51 | ||
| 51 | 52 | <dependencyManagement> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments