String flag1="http://74.208.194.142/admin/upload_image/1342594079_images (2).jpg";
URI uri = null;
try {
uri = new URI(flag1.replaceAll(" ", "%20"));
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(uri);
The console will display output as
http://74.208.194.142/admin/upload_image/1342594079_images%20(2).jpg