diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..359bb53
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
diff --git a/.idea/cys_cyh_UML.iml b/.idea/cys_cyh_UML.iml
new file mode 100644
index 0000000..b107a2d
--- /dev/null
+++ b/.idea/cys_cyh_UML.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml
new file mode 100644
index 0000000..6dafaf6
--- /dev/null
+++ b/.idea/dbnavigator.xml
@@ -0,0 +1,403 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..5a188cc
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 94a25f7..35eb1dd 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/out/production/cys_cyh_UML/.idea/.gitignore b/out/production/cys_cyh_UML/.idea/.gitignore
new file mode 100644
index 0000000..359bb53
--- /dev/null
+++ b/out/production/cys_cyh_UML/.idea/.gitignore
@@ -0,0 +1,3 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
diff --git a/out/production/cys_cyh_UML/.idea/cys_cyh_UML.iml b/out/production/cys_cyh_UML/.idea/cys_cyh_UML.iml
new file mode 100644
index 0000000..b107a2d
--- /dev/null
+++ b/out/production/cys_cyh_UML/.idea/cys_cyh_UML.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/cys_cyh_UML/.idea/dbnavigator.xml b/out/production/cys_cyh_UML/.idea/dbnavigator.xml
new file mode 100644
index 0000000..6dafaf6
--- /dev/null
+++ b/out/production/cys_cyh_UML/.idea/dbnavigator.xml
@@ -0,0 +1,403 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/cys_cyh_UML/.idea/misc.xml b/out/production/cys_cyh_UML/.idea/misc.xml
new file mode 100644
index 0000000..0548357
--- /dev/null
+++ b/out/production/cys_cyh_UML/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/cys_cyh_UML/.idea/modules.xml b/out/production/cys_cyh_UML/.idea/modules.xml
new file mode 100644
index 0000000..5a188cc
--- /dev/null
+++ b/out/production/cys_cyh_UML/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/cys_cyh_UML/.idea/vcs.xml b/out/production/cys_cyh_UML/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/out/production/cys_cyh_UML/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/cys_cyh_UML/README.md b/out/production/cys_cyh_UML/README.md
new file mode 100644
index 0000000..7915642
--- /dev/null
+++ b/out/production/cys_cyh_UML/README.md
@@ -0,0 +1,2 @@
+# cys_cyh_UML
+
diff --git a/out/production/cys_cyh_UML/uml10_10.class b/out/production/cys_cyh_UML/uml10_10.class
new file mode 100644
index 0000000..9df78f8
Binary files /dev/null and b/out/production/cys_cyh_UML/uml10_10.class differ
diff --git a/uml10_10.java b/uml10_10.java
index 22f3924..517f820 100644
--- a/uml10_10.java
+++ b/uml10_10.java
@@ -4,6 +4,8 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class uml10_10 {
+
+ // 将任意进制字符串转换为十进制整数
public static int toDecimal(String number, int base) {
int decimal = 0;
int power = 0;
@@ -11,10 +13,12 @@ public class uml10_10 {
for (int i = number.length() - 1; i >= 0; i--) {
char digit = number.charAt(i);
+ // 如果是数字字符(0-9)
if (Character.isDigit(digit)) {
int value = Character.getNumericValue(digit);
decimal += value * Math.pow(base, power);
}
+ // 如果是字母字符(A-F 或 a-f),表示10-15
else if (Character.isLetter(digit)) {
char upperDigit = Character.toUpperCase(digit);
int value = upperDigit - 'A' + 10;
@@ -111,12 +115,11 @@ public class uml10_10 {
// 显示结果
resultLabel.setText("转换后的" + targetBase + "进制数字是:" + convertedNumber);
- } catch (NumberFormatException | IllegalArgumentException ex) {
+ } catch (IllegalArgumentException ex) {
JOptionPane.showMessageDialog(frame, "错误: " + ex.getMessage(), "输入错误", JOptionPane.ERROR_MESSAGE);
}
}
});
-
// 显示窗口
frame.setVisible(true);
}