I want to convert following list into a int array. I have tried to use valueof
but I don't know how to use it. I don't want to parse it.
I have a string array here:
String[] arr1 = new String[]{"5","5","15","5","10","10", "5", "10", "20", "15"};
Here is the code I tried:
int num = Integer.valueOf(arr1);
I am getting a error message:
error: no suitable method found for valueOf(String[])
int num = Integer.valueOf(arr1);
^
method Integer.valueOf(String) is not applicable
(argument mismatch; String[] cannot be converted to String)
method Integer.valueOf(int) is not applicable
(argument mismatch; String[] cannot be converted to int)
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error