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日
最近浏览更多
szf123  LV12 2023年8月18日
heqian  LV17 2022年11月29日
Ckxlnd  LV13 2021年10月25日
huaua7676  LV30 2021年9月2日
小帆帆  LV1 2021年3月23日
2196316269  LV10 2021年2月25日
夏呆毛  LV5 2021年1月19日
zzh1125 2020年7月3日
暂无贡献等级
来水代码  LV1 2020年7月3日
夜上清元  LV8 2020年5月10日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友