code: public static boolean isLocalOrAnonymous(String className) {
          int i = className.lastIndexOf('$');
          if (i >= 0 && i + 1 < className.length()) {
              return Character.isDigit(className.charAt(i + 1));
          }
          return false;
      }
docs: Does a class name appear to designate an anonymous or local (defined
  inside method) class? Only the name is analyzed. No classes are loaded or
  looked up.
  
  @param className
  class name, slashed or dotted, fully qualified or unqualified
  @return true if className is the name of an anonymous or local class