Here I want to convert sting array values into integer array,Need to store all string values into integer array, Here is the string array:
private String[] aa = {"70","80","99","140","150","199","200","300",
"349","350","400","499","500","501","900","1000","1100","1200"};
If you're on Java8, you could do:
int[] array = Stream.of(aa).mapToInt(Integer::parseInt).toArray();
Loop through the array and convert it to int.
int []intArray = new int[strArray.length];
int i = 0;
for(String s : strArray)
intArray[i ++] = Integer.parseInt(s);
System.out.println(Arrays.toString(intArray));
int[] bb = new int[aa.length];
for (int i = 0; i < aa.length; i++) {
bb[i] = Integer.parseInt(aa[i]);
}
http://ideone.com/uJCAX2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With