<p>I want something that can check if a string is <code>"SELECT"</code>, <code>"INSERT"</code>, etc.  I'm just curious if this exists.</p>

why not start with
this stored procedure
and modify it to suit your needs, possibly even convert it to Java using the hashmap as Steve suggested.
Personally I like the idea of a stored procedure because different databases may have different keywords so it seems elegant to have the database pass judgement