Implement test type 2 in Java.
Implement test type 3 in Java.
Implement test type 5 in Java.
Implement test type 4 in Java.