code: public static void setBufferLimits(WsByteBuffer[] buffers, int[] limits) {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
              Tr.entry(tc, "setBufferLimits");
          }
  
          // Double check that parameters are not null.
          if ((buffers != null) && (limits != null)) {
              int bufferCapacity = 0;
              int limit = 0;
              // Loop through the buffers.
              // In case of errant parameters, protect from array out of bounds.
              for (int i = 0; i < buffers.length && i < limits.length; i++) {
                  // Double check for allowed null buffers.
                  if (buffers[i] != null) {
                      bufferCapacity = buffers[i].capacity();
                      limit = limits[i];
                      // Only update limit if it changed.
                      if (buffers[i].limit() != limit) {
                          // Double check that the new limit is valid.
                          if (bufferCapacity >= limit) {
                              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                  Tr.debug(tc, "Buffer [" + i + "] being updated from " + buffers[i].limit() + " to " + limit);
                              }
                              buffers[i].limit(limit);
                          } else {
                              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                  Tr.debug(tc, "Buffer [" + i + "] has capacity " + bufferCapacity + " less than passed in limit " + limit);
                              }
                          }
                      }
                  }
              }
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
              Tr.exit(tc, "setBufferLimits");
          }
      }
docs: Assign the limits of the passed in buffers to the specified values in the int array.
  The lengths of both arrays are expected to be similar. The limits are expected to
  be settable. IE, the respective buffers should have capacity >= to the limit.
  
  @param buffers
  @param limits