A silent development learner
Generate the file name with the following code
1 package info.haowei.util; 2 3 Import Java.text.SimpleDateFormat; 4 Import java.util.Date; 5 Import Java.util.Random; 6 7 public class Iptimestamp {8 9 private SimpleDateFormat SDF = null;11 private String IP = null;12 Public iptimestamp (String IP) {super (); This.ip = ip;18}19 publi C Iptimestamp () {super ();}24-Public String Getiptimerand () {StringBuffer buf = new StringBuffer (), if (this.ip! = null) {s[] = this.ip.split ("\ \"); /based on IP, the number in the IP is extracted by a dot partition (int i = 0; i < s.length; i++) {Buf.append (This.addzero (S[i], 3) )///insufficient three-digit 32}33}34 buf.append (This.gettimestamp ()), random r = new random ();//again in Add three random numbers to the end (int i = 0; i < 3; i++) {PNs buf.append (r.nextint));}39 retur n buf.tostring ();}41 PrivaTe string Addzero (string str, int len) {stringbuffer s = new StringBuffer (); s.append (str); (S.length () <len) {s.insert (0, 0);}49-s.tostring (); 51 }52 Gettimestamp () {//get timestamp THIS.SDF = new SimpleDateFormat ("Yyyymmddhhmmss SSS "); This.sdf.format return (New Date ());}58-Public String getDate () {this.sdf = NE W SimpleDateFormat ("Yyyy-mm-dd HH:mm:ss. SSS "); This.sdf.format return (New Date ()); 62}63}
Smartupload Automatic Upload Package