code: public BoxFileUploadSessionPart uploadPart(byte[] data, long offset, int partSize,
                                                 long totalSizeOfFile) {
          URL uploadPartURL = this.sessionInfo.getSessionEndpoints().getUploadPartEndpoint();
  
          BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), uploadPartURL, HttpMethod.PUT);
          request.addHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_OCTET_STREAM);
  
          MessageDigest digestInstance = null;
          try {
              digestInstance = MessageDigest.getInstance(DIGEST_ALGORITHM_SHA1);
          } catch (NoSuchAlgorithmException ae) {
              throw new BoxAPIException("Digest algorithm not found", ae);
          }
  
          //Creates the digest using SHA1 algorithm. Then encodes the bytes using Base64.
          byte[] digestBytes = digestInstance.digest(data);
          String digest = Base64.encode(digestBytes);
          request.addHeader(HttpHeaders.DIGEST, DIGEST_HEADER_PREFIX_SHA + digest);
          //Content-Range: bytes offset-part/totalSize
          request.addHeader(HttpHeaders.CONTENT_RANGE,
                  "bytes " + offset + "-" + (offset + partSize - 1) + "/" + totalSizeOfFile);
  
          //Creates the body
          request.setBody(new ByteArrayInputStream(data));
          BoxJSONResponse response = (BoxJSONResponse) request.send();
          JsonObject jsonObject = JsonObject.readFrom(response.getJSON());
          BoxFileUploadSessionPart part = new BoxFileUploadSessionPart((JsonObject) jsonObject.get("part"));
          return part;
      }
docs: Uploads bytes to an open upload session.
  @param data data
  @param offset the byte position where the chunk begins in the file.
  @param partSize the part size returned as part of the upload session instance creation.
  Only the last chunk can have a lesser value.
  @param totalSizeOfFile The total size of the file being uploaded.
  @return the part instance that contains the part id, offset and part size.