private static boolean ArePermutations(long n1, long n2) {
        char[] n1Chars = Long.toString(n1).toCharArray();
        char[] n2Chars = Long.toString(n2).toCharArray();

        if (n1Chars.length != n2Chars.length) {
            return false;
        }

        for (int i = 0; i < n1Chars.length; i++) {
            boolean isFound = false;
            for (int j = 0; j < n1Chars.length; j++) {
                if (n1Chars[i] == n2Chars[j]) {
                    isFound = true;
                    n2Chars[j] = ' ';
                    break;
                }
            }
            if (!isFound) {
                return false;
            }
        }
        for (int i = 0; i < n2Chars.length; i++) {
            if (n2Chars[i] != ' ') {
                return false;
            }
        }

        return true;
    }