I suggest that you test this out yourself. Start by writing a driver class that has a main() method. Then you can write code that calls the method that you have shown here. Then write some additional code to assert that it has the behavior to expect. The simplest way to do so is to just print out the results to the screen and compare it manually with what you expect to happen. If you want to get more sophisticated, you can add code that compares the results with an expected value automatically and just prints out a pass or fail message.
If this isn't entirely clear, show us some more code for the class that contains the method that you have written. I can help you fill in the details from there.