```
class MinStack {
Stack<Integer> stack = new Stack<Integer>();
Stack<Integer> min = new Stack<Integer>();
public void push(int x) {
stack.push(x);
if (min.empty()) {
min.push(x);
} else if (x <= min.peek()) {
min.push(x);
}
}
public void pop() {
if (!stack.empty()) {
System.out.println(stack.peek() == min.peek());
if (!min.empty() && (int)stack.peek() == (int)min.peek()) {
min.pop();
}
stack.pop();
}
}
public int top() {
if (!stack.empty()) {
return stack.peek();
} else {
return -1;
}
}
public int getMin() {
if (!min.empty()) {
return min.peek();
}
return -1;
}
```

}

Is there anyone know why should use cast here (int)stack.peek() == (int)min.peek()?

Thanks!