Some Java helpers I couldn't find anywhere else.