You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
447 B
19 lines
447 B
package com.hfkj.common.utils;
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.RoundingMode;
|
|
|
|
public class CommonUtil {
|
|
|
|
public static String unitLengthTransform(BigDecimal length){
|
|
|
|
if(length==null){
|
|
return null;
|
|
}
|
|
if (length.compareTo(new BigDecimal(1000)) > 0) {
|
|
return length.divide(new BigDecimal(1000), 2, RoundingMode.HALF_UP) + "千米";
|
|
}
|
|
|
|
return length + "米";
|
|
}
|
|
}
|
|
|