- package com.java.test;
- import java.text.SimpleDateFormat;
- import java.util.*;
- public class test1 {
- public static void main(String[] args) {
- String s = "a";
- Random rand = new Random();
- SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");//设置日期格式
- String time = df.format(new Date());
- int randnum1 = rand.nextInt(900)+100;
- <span style="color:#ff0000;">time=</span>time.concat(String.valueOf(randnum1));
- int randnum2 = rand.nextInt(90)+10;
- <span style="color:#ff0000;">time=</span>time.concat(String.valueOf(randnum2));
- s=time;
- System.out.println(s);
- System.out.println(String.valueOf(randnum1)+"abc");
- }
Java____随机数+时间戳+拼接=图片命名
最新推荐文章于 2023-05-06 09:47:01 发布