code: public static int[] getImageSize(
          InputStream input,
          int maxWidth,
          int maxHeight) throws IOException
      {
          int[] size = getImageSize(input);
          return getNewSize(size[0], size[1], maxWidth, maxHeight);
      }
docs: Returns the possible size of an image from the given input stream; the
  returned size does not overcome the specified maximal borders but keeps
  the ratio of the image. This method closes the given stream.
  
  @param input the input stream with an image
  @param maxWidth the maximal width
  @param maxHeight the maximal height
  @return the possible size of an image from the given input stream; the
  returned size does not overcome the specified maximal borders but
  keeps the ratio of the image