private static int[] calculateMultipartSize(long size) throws InvalidArgumentException {
  if (size > MAX_OBJECT_SIZE) {
    throw new InvalidArgumentException("size " + size + " is greater than allowed size 5TiB");
  }
  double partSize=Math.ceil((double)size / MAX_MULTIPART_COUNT);
  partSize=Math.ceil(partSize / MIN_MULTIPART_SIZE) * MIN_MULTIPART_SIZE;
  double partCount=Math.ceil(size / partSize);
  double lastPartSize=partSize - (partSize * partCount - size);
  if (lastPartSize == 0.0) {
    lastPartSize=partSize;
  }
  return new int[]{(int)partSize,(int)partCount,(int)lastPartSize};
}

private static int [ ] calculateMultipartSize ( long size ) throws InvalidArgumentException { if ( size > MAX_OBJECT_SIZE ) { throw new InvalidArgumentException ( "size " + size + " is greater than allowed size 5TiB" ) ; } double partSize = Math . ceil ( ( double ) size / MAX_MULTIPART_COUNT ) ; partSize = Math . ceil ( partSize / MIN_MULTIPART_SIZE ) * MIN_MULTIPART_SIZE ; double partCount = Math . ceil ( size / partSize ) ; double lastPartSize = partSize - ( partSize * partCount - size ) ; if ( lastPartSize == 0.0 ) { lastPartSize = partSize ; } return new int [ ] { ( int ) partSize , ( int ) partCount , ( int ) lastPartSize } ; }
calculates multipart size of given size and returns three element array contains part size , part count and last part size .
