将未知位数的数倒序输出

             最近刷PAT上的练习题,遇到将未知位数的数倒序输出,思考两天有个可以的方法,望见解!

        List<Integer> list = new ArrayList<Integer>();
		while(sum > 0) {
			int temp = sum % 10;
			list.add(temp);
			sum = sum / 10;
		}
		Collections.sort(list);




猜你喜欢

转载自blog.csdn.net/m0_37461645/article/details/79530283