public int reverse(int x) {
		long result = 0;
		boolean negative = false;
		if (x < 0)
			negative = true;
		x = Math.abs(x);
		while (x > 0) {
			int digit = x % 10;
			result = result * 10 + digit;
			x /= 10;
		}
		if (negative)
			result *= -1;
		if (result > Integer.MAX_VALUE || result < Integer.MIN_VALUE)
			return 0;
		return (int) result;
	}