code: private static Class loadClass(String name, ClassLoader classLoader) throws ClassNotFoundException
      {
          String className = name;
          boolean arrayType = false;
          Class primitiveArray = null;
  
          while (className.startsWith("["))
          {
              arrayType = true;
              if (className.endsWith(";"))
              {
                  className = className.substring(0, className.length() - 1);
              }
              if (className.equals("[B"))
              {
                  primitiveArray = byte[].class;
              }
              else if (className.equals("[S"))
              {
                  primitiveArray = short[].class;
              }
              else if (className.equals("[I"))
              {
                  primitiveArray = int[].class;
              }
              else if (className.equals("[J"))
              {
                  primitiveArray = long[].class;
              }
              else if (className.equals("[F"))
              {
                  primitiveArray = float[].class;
              }
              else if (className.equals("[D"))
              {
                  primitiveArray = double[].class;
              }
              else if (className.equals("[Z"))
              {
                  primitiveArray = boolean[].class;
              }
              else if (className.equals("[C"))
              {
                  primitiveArray = char[].class;
              }
              int startpos = className.startsWith("[L") ? 2 : 1;
              className = className.substring(startpos);
          }
          Class currentClass = null;
          if (null == primitiveArray)
          {
            try
            {
                currentClass = classLoader.loadClass(className);
            }
            catch (ClassNotFoundException e)
            {
                currentClass = Thread.currentThread().getContextClassLoader().loadClass(className);
            }
          }
  
          if (arrayType)
          {
              currentClass = (null != primitiveArray) ? primitiveArray : Array.newInstance(currentClass, 0).getClass();
              while (name.startsWith("[["))
              {
                  currentClass = Array.newInstance(currentClass, 0).getClass();
                  name = name.substring(1);
              }
          }
          return currentClass;
      }
docs: loadClass() provided by: Thomas Margreiter