已知

[["5","3",".",".","7",".",".",".","."],["6",".",".","1","9","5",".",".","."],[".","9","8",".",".",".",".","6","."],["8",".",".",".","6",".",".",".","3"],["4",".",".","8",".","3",".",".","1"],["7",".",".",".","2",".",".",".","6"],[".","6",".",".",".",".","2","8","."],[".",".",".","4","1","9",".",".","5"],[".",".",".",".","8",".",".","7","9"]]

 

经过函数处理solveSudoku 函数处理会对其进行赋值

将上面的三维数组打印处理

/**
 * @Auther: liuhaidong
 * Data: 2019/9/23 0023、16:40
 * Description:
 * @version: 1.0
 */
public class solveSudoku {
    public static void main(String[] args) {
        System.out.println("请输入字符串");
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String splitstr = str.substring(1,str.length()-1);
        char[][] board = new char[9][9];
        String[] strings = new String[9];
        int j =0;
        //这里的j是strings的赋值,又是字符数组board的赋值
        int a = 0, b = 0;
        for (int index = 0; index < splitstr.length(); index++) {
            //System.out.println(splitstr);
            if ('[' == splitstr.charAt(index)) {
                a = index;
            }
            else if (']' == splitstr.charAt(index))
            {
                b = index;
                strings[j] = splitstr.substring(a+1,b);
                //这个时候已经得到第一个字符串
                //去掉所有的引号
                strings[j] = strings[j].replaceAll("\"", "");
                int m =0;
                for(int i =0;i<strings[j].length();i++){
                    if(strings[j].charAt(i) == ','){
                        continue;
                    }else {
                        board[j][m] = strings[j].charAt(i);
                        ++m;
                        if(m==9){
                            break;
                        }
                    }
                }
                m =0;
                ++j;
                splitstr = splitstr.substring(b + 1, splitstr.length());
                index =0;
                a =0;
                b =0;
            }

        }
        solveSudoku(board);
        for(int m =0;m<9;m++){
            System.out.print("[");
            for(int n =0;n<9;n++) {
                if (n == 8) {
                    System.out.print(board[m][n]);
                } else {
                    System.out.print(board[m][n] + " ");
                }
            }
            System.out.println("]");
        }
    }

 结果