summaryrefslogtreecommitdiff
path: root/src/test/java/Test.java
diff options
context:
space:
mode:
authorwangchengcheng <[email protected]>2021-05-12 11:58:11 +0800
committerwangchengcheng <[email protected]>2021-05-12 11:58:11 +0800
commite48db45f137a00da35fd92d07c563a2fdae3b757 (patch)
treeebe756a5ccc6c747d140819f61a769a97add949a /src/test/java/Test.java
parentc22d59445f4a97fb4cbb02abe86ea013e49f98e5 (diff)
5.12
Diffstat (limited to 'src/test/java/Test.java')
-rw-r--r--src/test/java/Test.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/java/Test.java b/src/test/java/Test.java
new file mode 100644
index 0000000..0ba1f8b
--- /dev/null
+++ b/src/test/java/Test.java
@@ -0,0 +1,26 @@
+public class Test {
+
+ public static String intToIp(int ip) {
+ StringBuilder sb = new StringBuilder();
+ int num = 0;
+ boolean needPoint = false; // 是否需要加入'.'
+ for (int i = 0; i < 4; i++) {
+ if (needPoint) {
+ sb.append('.');
+ }
+ needPoint = true;
+ int offset = 8 * (3 - i);
+ num = (ip >> offset) & 0xff;
+ sb.append(num);
+ }
+ return sb.toString();
+ }
+
+ public static void main(String[] args) {
+ People people = new People();
+ if (2>1){
+ people.setAge(2);
+ }
+ System.out.println(people.getAge());
+ }
+}