а можно так извратиться:
public static void main(String[] args) throws Exception {
String str = "0 0,21875 -0,02625 0,3625 -1,091 -4,7875 6,875 13,5\n" +
" -0,0225 -0,05125 -0,0135625";
Scanner scanner = new Scanner(new InputStreamReader(new ByteArrayInputStream(str.getBytes())));
List<Float> numbers = new ArrayList<>();
while (scanner.hasNext()) {
numbers.add(scanner.nextFloat());
}
}
Добавил со Scanner( String )
public static void main(String[] args) {
String str = "0 0,21875 -0,02625 0,3625 -1,091 -4,7875 6,875 13,5\n" +
" -0,0225 -0,05125 -0,0135625";
Scanner scanner = new Scanner(str);
List<Float> numbers = new ArrayList<>();
while (scanner.hasNext()) {
numbers.add(scanner.nextFloat());
}
}