Java Function N Example Code Switching