方案一
double d = 0.121315;
System.out.println(String.format("%.2f",d));
方案二
double d = 0.121315;
double get_double = (double)(Math.round(d*100)/100.0);
System.out.println(get_double);
方案三
double d = 0.12312345;
BigDecimal get_double = new BigDecimal(d);
double get_doubles = get_double.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();
System.out.println(get_doubles);
方案四
DecimalFormat df =new DecimalFormat("#.00");
System.out.println(df.format(5.12312345));