code: public static int[] adjustBuffersForJSSE(WsByteBuffer[] buffers, int maxBufferSize) {
          int[] limitInfo = null;
          int dataAmount = 0;
          for (int i = 0; i < buffers.length && null != buffers[i]; i++) {
              // Valid buffer. Tally up how much data is in the buffer array so far.
              dataAmount += buffers[i].remaining();
              // Check if the max has been surpassed.
              if (dataAmount > maxBufferSize) {
                  // The max has been surpassed. Save the current array index and limit.
                  int savedLimit = buffers[i].limit();
                  limitInfo = new int[] { i, savedLimit };
                  // Adjust the limit to the max allowed.
                  int overFlow = dataAmount - maxBufferSize;
                  buffers[i].limit(savedLimit - overFlow);
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                      Tr.debug(tc, "adjustBuffersForJSSE: buffer [" + i + "] from "
                                   + savedLimit + " to " + buffers[i].limit());
                  }
                  // Since this was the key buffer, break from the loop.
                  break;
              } else if (dataAmount == maxBufferSize) {
                  // Boundaries of buffers and max lined up perfectly. No changes required.
                  break;
              }
          }
          return limitInfo;
      }
docs: The purpose of this method is to prepare the input buffers to be sent
  into a call to wrap or unwrap in the JSSE considering the limitations
  about how much data can be present in each buffer. This amount is determined
  by the amount of data between position and limit.
  
  @param buffers array of buffers being examined which will be sent into the JSSE
  @param maxBufferSize maximum size allowed for each buffer in the array
  @return int array of size 2. The first entry is the index of the buffer changed
  in the array. The second entry is the actual limit that will be saved
  for restoration after the call is made to wrap or unwrap in the JSSE.
  If it is identified that no changes are needed, null is returned.