code: public static Bitmap cropBitmap(Bitmap sourceBitmap, Rect bounds) {
          if ((bounds == null) || bounds.isEmpty())  {
              return null;
          }
  
          return cropBitmap(sourceBitmap, bounds.left, bounds.top, bounds.width(), bounds.height());
      }
docs: Creates a new {@link Bitmap} object with a rectangular region of pixels
  from the source bitmap.
  <p>
  The source bitmap is unaffected by this operation.
  
  @param sourceBitmap The source bitmap to crop.
  @param bounds The rectangular bounds to keep when cropping.
  @return A new bitmap of the cropped area, or {@code null} if the source
  was {@code null} or the crop parameters were out of bounds.