This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Please note that in Java, there are no n-dimensional (2D,3D etc.) arrays. What you are declaring is an array of arrays (and not a 2D array). In your code, you are initializing count as 0 and then passing it as size of array. So, in turn, you are creating an array of size 0. Obviously, the moment you access any element of that array, its gonna throw that typical exception.
If value of count is not known beforehand, and you are only concerned about key-value pairs (i.e. number of 'columns' is always 2), then how about using a Map (say HashMap)? That way, you don't need to declare its size during initialization.