Java Array Index Out Of Bounds Error For Array That Shouldn't Be Going Off Bounds : Hello helpful strangers on StackExchange. I have recently been working on a bit of a Java code and seems like I'm stuck. 

Here is my code http://pastebin.com/XcFWjbUt

This line in particular:  ma[count - 1] += 1;

Keeps going out of bounds whenever Trial tries t build it for some reason.I keep getting this error: 

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0

I would really appreciate any help that you could spare because I can't seem to find any reason as to why that array would be going off bounds. My thanks.