/**
* 播放量
* @param playCount:后台返回的播放量(单位:个)
* 播放量 < 1万,显示样式 1、10、1000
* 播放量 ≥ 1万,显示样式 1.2万 1.23万
* 播放量 ≥ 1亿,显示样式 1.2亿 1.23亿*/
public static String formatPlayCount(long playCount){
String standardPlayCount = "";
if (playCount < 0) {
standardPlayCount = "0";
} else if (playCount < 10000) {
standardPlayCount = String.valueOf(playCount);
} else if (playCount < 100000000) {
standardPlayCount = String.format(Locale.getDefault(), "%d.%02d万", playCount / 10000, playCount % 10000 / 100);
} else if (playCount > 100000000) {
standardPlayCount = String.format(Locale.getDefault(), "%d.%02d亿", playCount / 100000000, playCount % 100000000 / 1000000);
}
return standardPlayCount;
}
%02d 就是说长度不够2位的时候前面补0