private static Bitmap rotateAndFlipBitmapInt(
      Bitmap bitmap, int degrees, boolean flipHorizontally, boolean flipVertically) {
    if (degrees > 0 || flipHorizontally || flipVertically) {
      Matrix matrix = new Matrix();
      matrix.setRotate(degrees);
      matrix.postScale(flipHorizontally ? -1 : 1, flipVertically ? -1 : 1);
      Bitmap newBitmap =
          Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, false);
      if (newBitmap != bitmap) {
        bitmap.recycle();
      }
      return newBitmap;
    } else {
      return bitmap;
    }
  }
Rotate the given bitmap by the given degrees.<br>
New bitmap is created and the old one is recycled.
core/src/main/java/com/theartofdev/edmodo/cropper/BitmapUtils.java