Как считать из файла матрицу с разными элементами(положительные и отрицательные)
в файле лежит число (размерность квадратной матрицы) и сама матрица и я пытался считать это побитово в двумерный массив , но проблема была в том, что отрицательные элементы переставали таковыми быть(тоесть считывалось только число без учета знака)
private static int currentIndex = -1;
    
    //String to matrix numbers
    private static Integer next(String numbers[]) {
        ++currentIndex;
        while (currentIndex < numbers.length
                && numbers[currentIndex].equals(""))
            ++currentIndex;
        return currentIndex < numbers.length ?
                Integer.parseInt(numbers[currentIndex]) :
                null;
    }
    public static void main(String args[]) throws IOException {
        FileInputStream in = new FileInputStream("getMatrix.txt");
        byte[] str = new byte[in.available()];
        in.read(str);
        String text = new String(str);
        String[] numbers = text.split("\\D");
        int i, j;
        int n = next(numbers);
        int[][] matr = new int[n][n];
        for (i = 0; i < n; ++i) {
            for (j = 0; j < n; ++j) {
                matr[i][j] = next(numbers);
            }
        }
        for (i = 0; i < n; ++i, System.out.println()) {
            for (j = 0; j < n; ++j) {
                System.out.print(matr[i][j] + " ");
            }
        }
    }
P.S. : элементы матрицы могут быть не целочисленными