code: private static @Nullable Dimension toDimension(long width, long height) {
      if (width > 0L && height > 0L) {
        return new Dimension(width, height);
      }
      return null;
    }
docs: Convert with/height to dimension
  @param width Width
  @param height Height
  @return Dimension or null if width or height are not valid