/**
* 四舍五入
*/
DecimalFormat df=new DecimalFormat("#"); //不保留小数点
double d=0;
double PriceInRate = 0;
DecimalFormat df4 = new DecimalFormat("###.0000");
if(PriceInRate > 0){
PriceInRate = Double.parseDouble(df4.format(PriceInRate));//保留四位小数
}
/**
* 得到系统前5天时间
* <p>Author: sisi
* <p>Create Time: 2010-8-26
*/
Calendar calendar = Calendar.getInstance();//系统当前时间
calendar.add(Calendar.DATE, -5); //得到前5天
String yesterDayDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
System.out.println(yesterDayDate);
/**
* 路径的替换
* <p>Author: sisi
* <p>Create Time: 2010-8-26
*/
String filePath = "aa \\bb\\\\cc\\\\\\\\dd";
System.out.println("filePath =" + filePath);
filePath = filePath.replaceAll("\\\\", "\\\\\\\\");
System.out.println("filePath2 =" + filePath);
/**
* Substring
*/
String a = "123456789";
System.out.println("substring:"+a.substring(1, a.length()));
System.out.println("a.length():"+a.length());
// substring:23456789
// a.length():9