There are two array references here, and thus two potential array index out of bounds exceptions.
So either x has a value outside the range allowed for the num array
or i has a value outside the range allowed for the UserIDListUser array?
Which do you think it is?
Here is a short compilable and runnable example to help you debug your problem.
Can you spot it now?
In terms of making your code easier to write/debug I would suggest things like
- breaking your code up into methods to make each bit easier to understand and test - follow standard naming conventions for Java programming - such as using a lower case letter to start a variable name. It makes it easier to read for us experienced programmers, and more likely you will get an answer here :-)