public static byte[] getByte(String imgUrl) {
try {
URL url = new URL(imgUrl);
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
// connection.getResponseCode();
connection.setConnectTimeout(10000);
BufferedImage image = ImageIO.read(connection.getInputStream());
ByteArrayOutputStream out = new ByteArrayOutputStream();
ImageIO.write(image, "jpg", out);
return out.toByteArray();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}