public class Test8{
public static void main(String[] args){
String s = "1,2;3,4,5/6,7;8,9,10/11,12;13,14,15";
String[] s1=s.split("/");
double[][][] d;
d=new double[s1.length][][];
for(int i=0;i<s1.length;i++){
String[] s2=s1[i].split(";");
d[i]=new double[s2.length][];
for(int j=0;j<s2.length;j++){
String[] s3=s2[j].split(",");
d[i][j]=new double[s3.length];
for(int k=0;k<s3.length;k++){
d[i][j][k]=Double.parseDouble(s3[k]);
}
}
}
for(int i=0;i<d.length;i++){
for(int j=0;j<d[i].length;j++){
for(int k=0;k<d[i][j].length;k++){
System.out.print(d[i][j][k]+" ");
}
System.out.println();
}
System.out.println();
}
}
}
输出结果:
1.0 2.0
3.0 4.0 5.0
6.0 7.0
8.0 9.0 10.0
11.0 12.0
13.0 14.0 15.0