1.1万、9999.9万、1.1亿、999亿+
* 播放量的数字显示规则
1-9999,按照实际数字显示
10000-9999999,按照1万、1.1万、9999.9万
100000000-99900000000,按照1亿、1.1亿、999亿
>99900000000,统一显示为999亿+
所有数字显示均保留到小数点后一位即可
```java
/**
* 视频观看次数、评论数
*
* @paramtimes
* @return
*/
public static String watchNum(String times) {
String timeStr= "";
long count= 0;
try {
count= Long.parseLong(times);
} catch (NumberFormatException e) {
return timeStr;
}
if (count== 0) {
return timeStr;
} else if (count< 10000) {
return times;
} else if (count< 999 * 100000) {
long start= count/ 10000;
long end= count% 10000 / 1000;
if (end== 0) {
timeStr= start+ "万";
} else {
timeStr= start+ "." + end+ "万";
}
return timeStr;
} else if (count<= 999 * 100000000) {
long start1= count/ 100000000;
long end1= count% 100000000 % 1000000;
if (end1== 0) {
timeStr= start1+ "亿";
} else {
String s= String.valueOf(end1);
timeStr= start1+ "." + s.charAt(0) + "亿";
}
//return "999万+";
} else if (count> 999 * 100000000) {
return "999.9亿+";
}
return timeStr;
}
```