code: static public byte[] byteSubstring(byte[] bytes, int start, int end) {
  
          byte[] rc = null;
  
          if (0 > start || start > bytes.length || start > end) {
              // invalid start position
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  Tr.debug(tc, "Invalid start position in byteSubstring: " + start);
              }
          } else if (0 > end || end > bytes.length) {
              // invalid end position
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  Tr.debug(tc, "Invalid end position in byteSubstring: " + end);
              }
          } else {
              // now pull the substring
              int len = end - start;
              rc = new byte[len];
              System.arraycopy(bytes, start, rc, 0, len);
          }
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
              Tr.debug(tc, "byteSubstring returning: [" + getEnglishString(rc) + "]");
          }
          return rc;
      }
docs: Helper function for byte[]s to simulate the String.substring() method.
  
  @param bytes
  @param start
  @param end
  @return byte[] (null if invalid input)