Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite7b3af5

Browse files
start
1 parent7482c6d commite7b3af5

File tree

6 files changed

+115
-0
lines changed

6 files changed

+115
-0
lines changed

‎pom.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectxmlns="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+
<modelVersion>4.0.0</modelVersion>
6+
<packaging>jar</packaging>
7+
8+
<groupId>org.example</groupId>
9+
<artifactId>pythonchallenge</artifactId>
10+
<version>1.0.0</version>
11+
12+
<dependencies>
13+
<dependency>
14+
<groupId>junit</groupId>
15+
<artifactId>junit</artifactId>
16+
<version>4.13</version>
17+
<scope>test</scope>
18+
</dependency>
19+
</dependencies>
20+
21+
</project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
packagecom.yitianyigexiangfa.pythonchallenge;
2+
3+
importjava.text.NumberFormat;
4+
5+
publicclassLevel1 {
6+
7+
publicstaticvoidmain(String[]args) {
8+
Doubleresult =Math.pow(2,38);
9+
System.out.println(result);
10+
NumberFormatnumberFormat =NumberFormat.getInstance();
11+
numberFormat.setGroupingUsed(false);
12+
StringresultVal =numberFormat.format(result);
13+
System.out.println(resultVal);
14+
}
15+
16+
17+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
packagecom.yitianyigexiangfa.pythonchallenge;
2+
3+
publicclassLevel2 {
4+
5+
publicstaticvoidmain(String[]args) {
6+
char[]chars =str.toCharArray();
7+
for (charcharElment:chars) {
8+
// char newChar = charElment + 2;
9+
System.out.print(Character.toString(charElment));
10+
System.out.println();
11+
intvalue =Character.getNumericValue(charElment);
12+
System.out.print(value);
13+
}
14+
}
15+
16+
17+
18+
privatestaticStringstr ="g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq " +
19+
"ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. " +
20+
"sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.";
21+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packagecom.yitianyigexiangfa.pythonchallenge;
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
packagecom.yitianyigexiangfa.pythonchallenge;
2+
3+
importorg.junit.Test;
4+
5+
importjava.text.NumberFormat;
6+
7+
importstaticorg.junit.Assert.*;
8+
9+
publicclassLevel1Test {
10+
11+
@Test
12+
publicvoidpow(){
13+
Doubleresult =Math.pow(2,3);
14+
assertEquals(newDouble(8),result);
15+
}
16+
17+
@Test
18+
publicvoidnumberFormatTest(){
19+
Doubled =123456789123D;
20+
System.out.println(d);
21+
NumberFormatnumberFormat =NumberFormat.getInstance();
22+
StringdStr =numberFormat.format(d);
23+
assertEquals("123,456,789,123",dStr);
24+
numberFormat.setGroupingUsed(false);
25+
StringdStr2 =numberFormat.format(d);
26+
assertEquals("123456789123",dStr2);
27+
}
28+
29+
@Test
30+
publicvoiddoubleToString(){
31+
Doubled =Math.pow(2,38);
32+
System.out.println(d);
33+
NumberFormatnumberFormat =NumberFormat.getInstance();
34+
numberFormat.setGroupingUsed(false);
35+
StringnumStr =numberFormat.format(d);
36+
System.out.println(numStr);
37+
assertEquals("2.74877906944E11",d.toString());
38+
}
39+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
packagecom.yitianyigexiangfa.pythonchallenge;
2+
3+
importorg.junit.Test;
4+
5+
importstaticorg.junit.Assert.*;
6+
7+
publicclassLevel2Test {
8+
9+
@Test
10+
publicvoidcharToInteger() {
11+
byte[]bytes ="a".getBytes();
12+
intdigit =bytes[0];
13+
assertEquals(digit,97);
14+
System.out.println(digit);
15+
}
16+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp