Skip to content

Commit 9408e48

Browse files
committed
Java第十四天
1 parent 6ec9a6f commit 9408e48

63 files changed

Lines changed: 1116 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
2.24 MB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
5+
<classpathentry kind="output" path="bin"/>
6+
</classpath>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>day14_BigInteger_BigDecimal</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=1.7
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.source=1.7
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package cn.itcast_01;
2+
3+
import java.math.BigInteger;
4+
5+
/*
6+
* BigInteger:可以实现大整数的计算
7+
* 构造方法:BigInteger(String val)
8+
*/
9+
public class BigIntegerDemo {
10+
public static void main(String[] args) {
11+
// System.out.println(Integer.MAX_VALUE); // 2147483647
12+
13+
// Integer i = new Integer("2147483648"); // NumberFormatException
14+
// System.out.println(i);
15+
16+
BigInteger bi = new BigInteger("2147483648");
17+
System.out.println(bi);
18+
}
19+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package cn.itcast_01;
2+
3+
import java.math.BigInteger;
4+
5+
public class BigIntegerDemo2 {
6+
public static void main(String[] args) {
7+
BigInteger bi1 = new BigInteger("20");
8+
BigInteger bi2 = new BigInteger("10");
9+
10+
// public BigInteger add(BigInteger val)
11+
System.out.println("add:" + bi1.add(bi2));
12+
13+
// public BigInteger subtract(BigInteger val)
14+
System.out.println("subtract:" + bi1.subtract(bi2));
15+
16+
// public BigInteger multiply(BigInteger val)
17+
System.out.println("multiply:" + bi1.multiply(bi2));
18+
19+
// public BigInteger divide(BigInteger val)
20+
System.out.println("divide:" + bi1.divide(bi2));
21+
22+
// public BigInteger[] divideAndRemainder(BigInteger val)
23+
BigInteger[] bis = bi1.divideAndRemainder(bi2);
24+
for (int x = 0; x < bis.length; x++) {
25+
System.out.println(bis[x]);
26+
}
27+
28+
}
29+
}

0 commit comments

Comments
 (0)