<span style="font-size:18px;">package com;

import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpState;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;

public class GetPicture {

public static void main(String[] args) {
HttpClient client = new HttpClient();
GetMethod method = new GetMethod("http://ubmcmm.baidustatic.com/media/v1/0f000jlbjNGxF0G8PvRHcf.jpg");
try {
int code = client.executeMethod(method);
if(code==HttpStatus.SC_OK){
System.out.println("OK:"+code);
FileOutputStream fos = new FileOutputStream("D:\\pict.jpg",true);
fos.write(method.getResponseBody());
fos.flush();
fos.close();
}
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally{
method.releaseConnection();
}

}

}
</span>