There are some useful data structure in Java:
Array
If it is a sorted array, we can use Arrays.binarySearch(array, num)
BigInteger
If we need to process very big number, we can use BigInteger.
import java.math.BigInteger
x2 = x2.add(x1); // plus
x1 = x2.subtract(x2); // minus
String
s1.startsWith(s2, index);
Something I need to pay attention to:
- (int)(num%137) != (int)curr%137