final Calendar calendarTo = Calendar.getInstance();
calendarTo.setTime(to);
// construct the URL
final OutputStream os = new ByteArrayOutputStream();
final FormUtility form = new FormUtility(os, null);
form.add("s", ticker.getSymbol().toUpperCase());
form.add("a", "" + calendarFrom.get(Calendar.MONTH));
form.add("b", "" + calendarFrom.get(Calendar.DAY_OF_MONTH));
form.add("c", "" + calendarFrom.get(Calendar.YEAR));
form.add("d", "" + calendarTo.get(Calendar.MONTH));
form.add("e", "" + calendarTo.get(Calendar.DAY_OF_MONTH));
form.add("f", "" + calendarTo.get(Calendar.YEAR));
form.add("g", "d");
form.add("ignore", ".csv");
os.close();
final String str = "http://ichart.finance.yahoo.com/table.csv?"
+ os.toString();
return new URL(str);
}