//自定义一个类加载器:加载指定位置的.class文件(d:/class)
String path = "d:/clazz";
try {
FileInputStream in = new FileInputStream(new File(path+"/"+name+".class"));
//根据获取到的数据,创建Class对象
//需要一个将数据转换为字节数组的输出流
ByteArrayOutputStream out = new ByteArrayOutputStream();
int len = 0;
byte[] buf = new byte[1024];
while((len = in.read(buf)) != -1){
out.write(buf, 0, len);
}
byte[] byteArray = out.toByteArray();
for (int i = 0; i < byteArray.length; i++) {
byteArray = (byte) (byteArray - 1);
}