Do you want to check at a specific point in your program flow if the value has changed? Then you need a variable to store the old value and need to compare that to the current. If it is different you act and you set the old value variable to the current value.
Or do you want to get notified whenever the value changes? That is not possible for primitive values in
Java. You would need to create a class that capsules the value. The class should allow observers and throw events whenever the value changes (i.e. in setValue). The standard library has some support for this with
java.util.Observable and
java.beans.PropertyChangeSupport. The first is a general abstract definition, the latter allows an easy implementation.