我想将文本的双精度值放在二维数组上。我的文本有这样的 double 和 string 值
我的文字
deneme deneme 4.5 5.5 6.6 7.5 9.9 9.9
dsdsa sddsf 9.9 8.7 7.5 8.8 4.4 6.5
从字符串中提取双精度值。我的程序输出是
4.5 5.5 6.6 7.5 9.9 9.9 9.9 8.7 7.5 8.8 4.4 6.5
我怎么能做我的输出六重奏。如果我能做到这一点,我将对每一行进行排序
一线:4.5 5.5 6.6 7.5 9.9 9.9
二线:9.9 8.7 7.5 8.8 4.4 6.5
public static void main(String[] args) throws IOException {
ArrayList<String> puan;
puan = okuDiziyeKoy("C:\\deneme\\HW.txt");
System.out.format("%d kayıt okundu.%n", puan.size());
for (int j = 0; j < puan.size(); j++) {
String point = puan.get(j);
String[] edit = point.split("[\\{\\}\\)]");
for (String s : edit) {
String a = s.replaceAll("[\\}\\-\\>\\>\\]\\[\\#\\*\\{]+", "");
String b = a.replaceAll("[\\.]+", ",");
Scanner scanner = new Scanner(b);
while (scanner.hasNext()) {
if (scanner.hasNextDouble()) {
Double doubleValue = scanner.nextDouble();
List<Double> numbers = new ArrayList<Double>();
numbers.add(doubleValue);
// System.out.println(Arrays.deepToString(numbers.toArray()));
final int col = 6;
final int rows = numbers.size() % col == 0 ? numbers.size() / col : numbers.size() / col + 1;
double[][] deneme = new double[rows][col];
for (int i = 0; i < rows; i++) {
for (int k = 0; k < col; k++) {
if (i == rows - 1 && k >= numbers.size() % col)
break;
deneme[i][k] = numbers.get(k + col * i);
System.out.print( deneme[i][k]+ " ");
}// for k end
System.out.println(); // go to next line
} // for i end
}// if scan end
else {
//if it is string comes value here
String stringValue = scanner.next();
}// if scan end
}// while end
}// for string s
}// for end
}// main end