Scanner sc = new Scanner(System.in);
String s1 = sc.nextLine();
s1 = s1.substring(1,s1.length() - 1);
String[] s2 = s1.split(",");
int[] nums = new int[s2.length];
for (int i = 0;i < nums.length;i++)
{
nums[i] = Integer.valueOf(s2[i]);
}
用的笨办法