public static void downloadPhotos(String[] ids) throws IOException,
			JSONException {
		File f = new File("C:\\Users\\Yicheng Ye\\Desktop\\photos.json");
		BufferedReader br = new BufferedReader(new FileReader(f));
		String line = null;
		int lineCount = 0;
		while ((line = br.readLine()) != null) {
			JSONTokener token = new JSONTokener(line);
			JSONObject root = new JSONObject(token);
			if (root.has("images")) {
				JSONArray objs = root.getJSONArray("images");
				for (int i = 0; i < objs.length(); i++) {
					JSONObject obj = objs.getJSONObject(i);
					URL url = new URL(obj.getString("url"));
					File dir = new File(
							"C:\\Users\\Yicheng Ye\\Desktop\\photos\\"
									+ ids[lineCount] + "\\");
					if (!dir.exists())
						dir.mkdir();
					File outFile = new File(dir, obj.getString("id") + ".jpg");
					BufferedOutputStream bo = new BufferedOutputStream(
							new FileOutputStream(outFile));
					InputStream is = url.openStream();
					byte[] buff = new byte[1024];
					while (true) {
						int readed = is.read(buff);
						if (readed == -1) {
							break;
						}
						byte[] temp = new byte[readed];
						System.arraycopy(buff, 0, temp, 0, readed);
						bo.write(temp);
					}
					is.close();
					bo.close();
				}
			}
			lineCount++;
		}
		br.close();
	}