Added java code for OR-3 Query.