package com.math; import java.util.Arrays; public class SortIDString { public static void main(String[] args) { String user_ids = "1,3,2,299,33,2"; String[] _ids = user_ids.split(","); System.out.println("排序前:" + Arrays.toString(_ids).replaceAll("\\[|\\]", "")); for (int i = 0; i < _ids.length; i++) { int largest = i; for (int j = i; j < _ids.length; j++) { if (Integer.parseInt(_ids[j]) > Integer.parseInt(_ids[largest])) largest = j; } int temp; temp = Integer.parseInt(_ids[i]); _ids[i] = _ids[largest]; _ids[largest] = temp + ""; } System.out.println("排序后:" + Arrays.toString(_ids).replaceAll("\\[|\\]", "")); } }

小帆帆 LV1
2021年3月23日
2196316269 LV10
2021年2月25日
ALexmercer LV1
2020年3月9日
1065353767 LV1
2020年2月20日
jiaowoyuege LV11
2019年12月30日
1448790753 LV4
2019年12月26日
jp6863655 LV13
2019年11月26日
ttxszz LV1
2017年2月27日
gutong LV10
2015年10月1日
ahao LV16
2015年9月22日