Java program used to write interview-style functions