将整数数组转换为具有固定小数位数的字符串数组
//来 自 nowjava - 时代Java //package com.nowjava; import java.util.ArrayList; public class Main { /** * converts an array of integers to an array of strings with a constant number of decimals * * @param integerArrayList the list of integers that you want to convert */ public static ArrayList<String> intsToPaddedStrings( ArrayList<Integer> integerArrayList) { if (integerArrayList.size() > 0) { ArrayList<String> stringArrayList = new ArrayList<String>(); int maxInt = integerArrayList.get(0); for (Integer i : integerArrayList) { if (i.compareTo(maxInt) == 1) { maxInt = i; } } int numDigits = String.valueOf(maxInt).length(); for (Integer i : integerArrayList) { /** from * 时代Java公众号 - N o w J a v a . c o m **/ String string = String.valueOf(i); while (string.length() < numDigits) { stri