//dataJson为数据
JSONObject sortJson = new JSONObject(new LinkedHashMap<>());
List<String> keyList = new ArrayList<>();
for (String key : dataJson.keySet()) {
keyList.add(key);
}
Collections.sort(keyList,new Comparator<String>() {
@Override
public int compare(String str1, String str2) {
return str2.compareTo(str1);
}
});
for (String key : keyList) {
sortJson.put(key, numberObj.getInteger(key));
}