mirror of
https://github.com/Dichgrem/Java.git
synced 2026-02-05 05:51:57 -05:00
update:demo12
This commit is contained in:
14
com/study/demo12/TestVerifyCodeLogic.java
Normal file
14
com/study/demo12/TestVerifyCodeLogic.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.study.demo12;
|
||||
|
||||
public class TestVerifyCodeLogic {
|
||||
public static void main(String[] args) {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
String last4Digits = timestamp.substring(timestamp.length() - 4);
|
||||
String code = "CODE" + last4Digits;
|
||||
|
||||
System.out.println("完整时间戳: " + timestamp);
|
||||
System.out.println("时间戳后4位: " + last4Digits);
|
||||
System.out.println("生成的验证码: " + code);
|
||||
System.out.println("验证码格式正确: " + (code.startsWith("CODE") && code.length() == 8));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user