If you are going to write a parser like this it is going to a fairly big project because the sql query could get more and more complex. You could try using ANTLR. It has an sql grammar. Or GeneralSqlParser or other parser to tokenize your sql statement an then construct your mongo statements.
If you are not particular about writing a program you can rely on the Query Mongo project. It does what you need. Please refer to that site.
Still you are determined to get a quick solution for this via Java, you can try the below program. This uses jsoup to submit you query to the querymongo site and retrieve the mongo query.
Hope this helps :)
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
public class MongoQuery {
public static void main(String[] args) throws Exception {
System.setProperty("http.proxyHost", "10.9.248.37");
System.setProperty("http.proxyPort", "18082");
Document doc = Jsoup.connect("http://www.querymongo.com/")
.data("MySQLQuery", "SELECT * FROM STOCK WHERE symbol like 'FLIR%' and price > 24.04 and price < 24.39")
.post();
for(Element e : doc.select("#mongoQuery")){
System.out.println(e.val());
}
}
}