public boolean isPalindrome2(int x) {
        if (x < 0) return false;
        int div = 1;
        while (x / div >= 10) div *= 10;
        int mul = 1;
        while (div > mul) {
            if ((x / div) % 10 != (x / mul) % 10) return false;
            div /= 10;
            mul *= 10;
        }
        return true;
    }