public static void main(String[] args) {
        int maxPandigital = 0, nextPandigital = 0, i, n, nBound;
        String concProd = "";
        for (i = 1; i <= 9876; i++) {
            for (nBound = 1; nBound <= 9; nBound++) {
                for (n = 1; n <= nBound && concProd.length() < 10; n++) {
                    concProd += i * n;
                }
                if (concProd.length() > 9) {
                    concProd = "0";
                }
                if (isPandigital(Long.parseLong(concProd))) {
                    nextPandigital = Integer.parseInt(concProd);
                    if (nextPandigital > maxPandigital) {
                        maxPandigital = nextPandigital;
                    }
                }
                concProd = "";
            }
        }
        System.out.println(maxPandigital);
    }