public static double of(int[] truth, int[] prediction) {
        if (truth.length != prediction.length) {
            throw new IllegalArgumentException(String.format("The vector sizes don't match: %d != %d.", truth.length, prediction.length));
        }

        ConfusionMatrix confusion = ConfusionMatrix.of(truth, prediction);
        int[][] matrix = confusion.matrix;

        if (matrix.length != 2 || matrix[0].length != 2) {
            throw new IllegalArgumentException("MCC can only be applied to binary classification: " + confusion);
        }

        int tp = matrix[1][1];
        int tn = matrix[0][0];
        int fp = matrix[0][1];
        int fn = matrix[1][0];

        int numerator = (tp * tn - fp * fn);
        double denominator = Math.sqrt(tp + fp) * Math.sqrt(tp + fn) * Math.sqrt(tn + fp) * Math.sqrt(tn + fn);

        return numerator / denominator;
    }
@Test
    public void test0(){
        System.out.println("numerator = 0");
        int[] truth = {0, 0, 0, 0, 1, 1, 1, 1};
        int[] prediction = {0, 1, 0, 1, 0, 1, 0, 1};

        double expResult = 0;
        double result = MatthewsCorrelation.of(truth, prediction);
        assertEquals(expResult, result, 1E-5);
    }