Yes you can, simple call the applyBreak method from the main method, dont place it there.
If you put the method outside the main method (but still in the same class) like this:
*Edit*
Yes, I was planning on explaining how that works when he understood the problem that will come