Aha! You're not using the loop variables as index!
myArray[a][b] = charArray[nextChar];
You're using x and y which are out of bounds.
Type: Posts; User: PhHein
Aha! You're not using the loop variables as index!
myArray[a][b] = charArray[nextChar];
You're using x and y which are out of bounds.
What does "doesn't seem to work" mean? Did you blow up your toaster? What error messages/stack traces do you get now?
You have to stop looping as soon as nextchar will be >= charArray.length
You're iterating x*y times, which is likely more than charArray.length, because you round up. So nextchar will be >= than charArray.length, causing the Exception.