展开全部
package com.golden.servlet.util;
import java.util.Arrays;
public class Test {
public static void main(String[] args) {
String str = "1,2;3,4,5;6,7,8;9";
for (double[] ds : parseDoubleArray(str)) {
System.out.println(Arrays.toString(ds));
}
}
public static double[][] parseDoubleArray(String arraystr){
double[][] ds = new double[arraystr.split(";").length][];
for (int i = 0; i
String temp = arraystr.split(";")[i];
String[] temp1 = temp.split(",");
double[] tempArray = new double[temp1.length];
for (int j = 0; j
tempArray[j] = Double.valueOf(temp1[j]);
}
ds[i] = tempArray;
}
return ds;
}
}
结果:62616964757a686964616fe58685e5aeb931333337386639
[1.0, 2.0]
[3.0, 4.0, 5.0]
[6.0, 7.0, 8.0]
[9.0]