String base64String = "data:image/png;base64,iVBORw0KGg..." //Sample
base64String = base64String .replace("data:image/png;base64,", "");
byte[] imageBytes = javax.xml.bind.DatatypeConverter.parseBase64Binary(base64String );
//Save base64 as PNG to ur local.
File file1 = new File("C:\\sample\\abc.png");
try ( FileOutputStream fos = new FileOutputStream(file1); ) {
byte[] decoder = Base64.getDecoder().decode(base64String );
fos.write(decoder);
System.out.println("image File Saved");
} catch (Exception e) {
e.printStackTrace();
}