code: public static int getChunkSize(BoxUploadSession uploadSession, int partNumber, long fileSize) {
          if (partNumber == uploadSession.getTotalParts() - 1) {
              return (int) (fileSize - partNumber * uploadSession.getPartSize());
          }
          return uploadSession.getPartSize();
      }
docs: Computes the actual bytes to be sent in a part, which equals the partsize for all parts
  except the last.
  @param uploadSession
  @param partNumber
  @param fileSize
  @return