Input: " 10 50 10 40 50 80 60 20 ".
I want to convert it into string array then into int array. The problem is that when I split with space, it shows errors as:
- 1st string is
" 10" - 2nd string is
" 50" - 3rd string is
"10"
Code:
s = line.split(" ");
for(i=0;i<8;i++)
{
arr= Integer.parseInt(s[i]);
System.out.println(arr);
}
I want it should only string array with no space
- 1st string is
"10" - 2nd string is
"50" - 3rd string is
"10"