Here are the examples of the java api class taken from open source projects.

1. FaceDetectApp#annotateWithFace()

Project: cloud-vision
Source File:
View license
   * Annotates an image {@code img} with a polygon defined by {@code face}.
private static void annotateWithFace(BufferedImage img, FaceAnnotation face) {
    Graphics2D gfx = img.createGraphics();
    Polygon poly = new Polygon();
    for (Vertex vertex : face.getFdBoundingPoly().getVertices()) {
        poly.addPoint(vertex.getX(), vertex.getY());
    gfx.setStroke(new BasicStroke(5));
    gfx.setColor(new Color(0x00ff00));