code: public static byte[] readClass(String className) throws IOException {
        // convert to a resource
        className = ClassUtils.classNameToResource(className);
  
        byte[] b = new byte[2500]; // I'm assuming that I'm reading class that are not too big
  
        int length;
  
        try (InputStream in = ClassDefinitionUtils.class.getClassLoader().getResourceAsStream(className)) {
           length = in.read(b);
        }
  
        if(length >= 2500) {
           throw new IllegalArgumentException("The class is longer that 2500 bytes which is currently unsupported");
        }
  
        byte[] copy = new byte[length];
        System.arraycopy(b, 0, copy, 0, length);
        return copy;
     }
docs: Read the bytes of a class from the classpath
  
  @param className full class name including the package
  @return the bytes representing the class
  @throws IllegalArgumentException if the class is longer than 2500 bytes
  @throws IOException if we fail to read the class