date日期

NumberFormat//是一个抽象方法,
DecimalFormat //由它来实现
eg.// 将浮点型显示为百分数
NumberFormat format = new DecimalFormat("%"); 
system.out.pritln(format.format(0.05))

NumberFormat format =new DecimalFormat("#,###.00") // 四舍五入取值, 
    #: 只显示有效数字, 表示没有或多个
    0: 如果位数少于0的个数, 则用0补全
eg.
//system.out.pritln(format.format(12334455.34552))

DateFormat(日期的处理)
java.sql.Date---查看在线API
java.util.Date---目前使用的比较多的日期类型
实例化一个日期

  

Date date = new Date(); // 获取当前的系统时间  
  打印 date.format("%tY",DATE)   //表6.1
Date date = new Date(Long times); // 指定一个日期
calendar c  = calendar.getInstance();
C.setTime(date);
syso(c.get(calendar.year)); //点后的 东西是从 在线文档里找的  如 .day_of_year
java.sql.Date !! java.sql.Time !!! 
java.sql.Timestamp
eg.
Timestamp t = new Timestamp(27837391837)   //传入数字
syso(string.format("%tF",t));

!!!!
System.currentTimeMillis() 
DateFormat, 抽象类, 可以格式化日期类型 yyyy-MM-dd ahh:mm:ss(SSSZ) 单独取出月份 
Calendar类 指定一个日期 
setTime(Date date) setTime(Long l)

Long k = system.currentTimeMillis();  //时间戳
syso(k);

String生成器 
!! StringBuffer---线程安全   
//用于字符串拼接比较多的时候,用这个
StringBuffer buffer = new StringBuffer();
Long start = system.currentTimeMillis();

for( int i = 0; i<1000 ; i++){
buffer.append("a");    
//因此数字比较大时,要用这种.
// s += "a" ; 
//对比这种, 上面的要快非常多..每次添加时,都要不停地重新new,
}
Long end = system.currentTimeMillis();
syso(end - start);

StringBuilder--线程不安全

  

原文地址:https://www.cnblogs.com/ziyanxiaozhu/p/8056874.html