工作中用到的

获取当前时间

SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date date = new Date();
            String time = format.format(date);

时间戳

 //时间戳
        String nowTime = System.currentTimeMillis()/1000L+"";

随机数

//随机数
        Random random = new Random();
        String flag="";
        for(int i=0;i<6;i++){
            flag+=random.nextInt(10);
        }
String  s = "";
        for(int i=0;i<6;i++) {
          s+=(int)(Math.random()*10);         
        }
         System.out.println(s);
    }
//反转
String string = "abc";
string = new StringBuilder(string).reverse().toString();
原文地址:https://www.cnblogs.com/hudj/p/7232374.html