I am not sure if that is most efficient way, but you could:
1) convert data from that string to bytes representing image, like:
String dataUrl = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAEHUlEQVQ4TzWUW49VRRCFv6rq3ufMmTNn...";
String header = "data:image/png;base64";
String encodedImage = dataUrl.substring(header.length()+1); //+1 to include comma
byte[] imageData = Base64.getDecoder().decode(encodedImage); //decode bytes
2) convert that bytes to BufferedImage holding PNG image
BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(imageData));
3) then based on http://www.mkyong.com/java/convert-png-to-jpeg-image-file-in-java/ you could create separate BufferedImage and fill it using JPG fromat
// create a blank, RGB, same width and height, and a white background
BufferedImage newBufferedImage = new BufferedImage(bufferedImage.getWidth(),
bufferedImage.getHeight(), BufferedImage.TYPE_INT_RGB);
newBufferedImage.createGraphics().drawImage(bufferedImage, 0, 0, Color.WHITE, null);
(this step can be simplified with ImageIO.write(source, format, output) as shown in @Channa Jayamuni answer)
4) finally we can write these bytes to separate byte array with little help of ByteArrayOutputStream
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(newBufferedImage, "jpg",baos);
byte[] byteArray = baos.toByteArray();
base64,, correct?iVB...stuff is the base64 data. no idea if java has a data uri parsing library (probably does), but if nothing else, you can simply use a string operation to extract the b64 data and then load that into a b64-decoder