some java code for reuse