The above algorithm should be extracted to a method, then this line would just be something like:
```java
setNewValue(getCorrectedGotoPage());
```