Converting a StringBuilder To Integer Values In Java [duplicate]
问题 This question already has answers here : How to split a string in Java (34 answers) Closed 4 years ago . Well the question is very simple. Lets say there is a StringBuilder sb Inside of sb numbers like this: "25 9631 12 1895413 1 234564" How to get those numbers one by one and initialize them into an ArrayList<Integer> list or to be more specific is it possible? Thanks for checking! 回答1: Try to split that string like: String[] numbers = sb.toString().split(" ");//if spaces are uneven, use \\s