Checking variable in an array in JSP

I need a code which an check for a given userid in an array and if true, redirect the page.

like:

string userid = “xyz”
string array = (“abc”, adb, “dgh” , “jdgh”, “kiy”)

if userid is present in array
{redirect1}
else {redirect2}


pls help me with syntax for JSP