I have to input a string with numbers ex: 1,2,3,4,5. That\'s a sample of the input, then I have to put that in an array of INT so I can sort it but is not working the way it
String input = "2,1,3,4,5,10,100"; String[] strings = input.split(","); int[] numbers = new int[strings.length]; for (int i = 0; i < numbers.length; i++) { numbers[i] = Integer.parseInt(strings[i]); } Arrays.sort(numbers); System.out.println(Arrays.toString(numbers));