Working with arrays is a pain in the ass... Even if we use java 8 we should wrap this array into an ArrayList.

Please change it and the whole code will be a lot simpler.