回答編集履歴
1
清書版
test
CHANGED
@@ -31,3 +31,31 @@
|
|
31
31
|
System.out.println(b);
|
32
32
|
|
33
33
|
```
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
# 清書版(ステップ数削減w)
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
```
|
42
|
+
|
43
|
+
long a = -30456423424563463L;
|
44
|
+
|
45
|
+
String b = Long.toString(a);
|
46
|
+
|
47
|
+
Pattern p = Pattern.compile("([0-9])([0-9]{3}(,.*)*)$");
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
while (p.matcher(b).find())
|
52
|
+
|
53
|
+
b = p.matcher(b).replaceFirst("$1,$2");
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
System.out.println(b);
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
```
|