Conversion between String type array and an array of type Integer

         The problem we do not know is not met, this is my rewrite a method is due to be covered by the method parameter of type String array, the method parameter of type Integer array is covered,

The method of the implementation process, I do not want to re-write it again above the direct retrieval of hope, which relates to the type Integer array to a String array.


Integer String to code as follows:

                List<Integer> LString = new ArrayList<Integer>();
Integer[] result = null;

for (int i = 0; i < param.length; i++) {
LString.add(new Integer(param[i]));
}

int size = LString.size();
result = (Integer[]) LString.toArray(new Integer[size]);
return result;


Integer String to convert code is as follows:

                List<String> LString = new ArrayList<String>();
  String[] result = null;

for (int i = 0; i < param.length; i++) {
LString.add(param[i].toString());
}

int size = LString.size();
result = (String[]) LString.toArray(new String[size]);
return result;

Guess you like

Origin blog.csdn.net/N_E_W_J_A_V_A/article/details/65433508