package test;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 生成
编码
* @author Administrator
*
*/
public class Test {
public static void main(String[] args){
StringBuffer sb = new StringBuffer();
char[]
projectTypes = {'B','S'};
char[] listingTypes = {'R','D','G'};
//将时间转换成String
Date date = new Date();
System.out.println("++++++++++++++++"+date+"++++++++++++++++");
SimpleDateFormat formatter = new SimpleDateFormat("yyMMdd");
String dateString = formatter.format(date);
System.out.println("转换后String类型的时间"+dateString);
sb.append(projectTypes[0]).append(listingTypes[0]).append(dateString);
System.out.println("++++++++++++++++"+sb+"++++++++++++++++++");
//code后面6位,补不足补零
Long n = 1005l;
NumberFormat numFormatter = NumberFormat.getNumberInstance();
numFormatter.setMinimumIntegerDigits(6);
numFormatter.setGroupingUsed(false);
String s = numFormatter.format(n);
System.out.println("++++++++++++++++"+s+"++++++++++++++++");
sb.append(s);
String code = sb.toString();
System.out.println("-----------------"+code+"----------------");
}
}