|
@@ -18,27 +18,34 @@ public class AppendUtils {
|
|
|
public static String stringAppend(Integer number) {
|
|
|
String s = null;
|
|
|
int i = 0;
|
|
|
- if (number >1000) {
|
|
|
+ if (number >=1000) {
|
|
|
BigDecimal e = new BigDecimal(number);
|
|
|
BigDecimal f = new BigDecimal(1000);
|
|
|
BigDecimal divide = e.divide(f);
|
|
|
String d = divide.toString();
|
|
|
String[] split = d.split("\\.");
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
- stringBuilder.append("k"+split[0]);
|
|
|
- if (split.length>1) {
|
|
|
- stringBuilder.append("+");
|
|
|
- Integer integer = Integer.parseInt(split[1])*100;
|
|
|
- stringBuilder.append(integer);
|
|
|
+ if (split.length==1){
|
|
|
+ stringBuilder.append("k"+split[0]+"+0");
|
|
|
+ }else {
|
|
|
+ stringBuilder.append("k" + split[0]);
|
|
|
+ if (split.length > 1) {
|
|
|
+ stringBuilder.append("+");
|
|
|
+ Integer integer = Integer.parseInt(split[1]) * 100;
|
|
|
+ stringBuilder.append(integer);
|
|
|
+ }
|
|
|
}
|
|
|
return stringBuilder.toString();
|
|
|
- }else if (number==1000){
|
|
|
- return "K1+0";
|
|
|
} else {
|
|
|
- return String.valueOf("k0+"+number);
|
|
|
+ return "k0+" + number;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static void main(String[] args) {
|
|
|
+ String s = AppendUtils.stringAppend(800);
|
|
|
+ System.out.println(s);
|
|
|
+ }
|
|
|
+
|
|
|
public static int stringSplit(String miles) {
|
|
|
int substring=0;
|
|
|
String[] split = miles.split("\\+");
|