1 public class Test {
 2     public static void main(String args[]) {
 3         String s = "1,2;3,4;5,6;7,8";
 4         String[] sFirst = s.split(";");
 5         double[][] d;
 6         d = new double[sFirst.length][2];
 7         for(int i = 0; i<sFirst.length; i++) {
 8             String[] sSecond = sFirst[i].split(",");
 9             d[i] = new double[sSecond.length];
10             for(int j =0; j < sSecond.length; j++) {
11                 d[i][j] = Double.parseDouble(sSecond[j]);
12             }
13         }
14         for(int i = 0;i < d.length; i++) {
15             for(int j = 0; j < d[i].length; j++) {
16                 System.out.println(d[i][j]);
17             }
18             System.out.println();
19         }
20         
21     }
22     
23 }

 

posted on 2018-08-27 11:53  蕾拉  阅读(1191)  评论(0)    收藏  举报