Take a look at the your while
loop. The ==
operator in Java checks if two objects are the same reference, which is rarely a good idea to rely on, and probably causes this loop to loop infinately (or at least until the program crashes with an exception). What you'd want to do, logically, is check that both strings are equal, i.e., both contain the string "D"
:
while (!transaction[i].getAction().equals("D"))