code: private static byte[] classToByteArray(Class<?> clazz) throws ClassNotFoundException {
          String fileName = clazz.getName();
          int lastDot = fileName.lastIndexOf('.');
          if (lastDot > 0) {
              fileName = fileName.substring(lastDot + 1);
          }
          URL classUrl = clazz.getResource(fileName + ".class");
          if (classUrl == null) {
              throw new ClassNotFoundException(clazz.getName());
          }
          byte[] buf = new byte[1024];
          ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
          InputStream in = null;
          try {
              in = classUrl.openStream();
              for (int r; (r = in.read(buf)) != -1;) {
                  out.write(buf, 0, r);
              }
              return out.toByteArray();
          } catch (IOException ex) {
              throw new ClassNotFoundException(clazz.getName(), ex);
          } finally {
              closeQuietly(in);
              closeQuietly(out);
          }
      }
docs: Load the helper {@link Class} as a byte array, to be redefined in specified {@link ClassLoader}.
  @param clazz - The helper {@link Class} provided by this bundle
  @return The binary content of helper {@link Class}.
  @throws ClassNotFoundException Helper class not found or loading failed