Have fun.
/**
* @author FearMe
* @param name the exact item name
* @return the price(not 100% accurate)
* @throws IOException
*/
private int getPrice(String name) throws IOException {
if (name.length() <= 3) return 0;
URL url = new URL("http://forums.zybez.net/runescape-2007-prices/api/item/" + name.replace("+", "%2B").replace(' ', '+').replace("'", "%27"));
URLConnection con = url.openConnection();
con.addRequestProperty("User-Agent", "Mozilla/5.0");
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String line = "";
String inputLine;
while ((inputLine = in.readLine()) != null)
line += inputLine;
in.close();
if (!line.contains("average\":\""))
return 0;
line = line.substring(line.indexOf("average\":\"")
+ "average\":\"".length());
line = line.substring(0, line.indexOf("\""));
return (int) Math.round(Double.parseDouble(line));
}