I was trying to solve a programming Christmas problem which you can read here: advent of code day 8
I used Java to solve this problem so I have the following function