Question: [This answer](https://stackoverflow.com/a/1654928/160206) to another questions suggests, as a workaround for finding anonymous classes via reflection, to simply try all names, starting with `...$1` and counting up until no more can be found. Is this guaranteed to find all inner classes, or could there be cases where they start at 0 or some numbers are left out (for whatever reason)?

Answer: 
The [JLS 13.1](http://docs.oracle.com/javase/specs/jls/se7/html/jls-13.html#jls-13.1) specifies:

> 
> The class or interface must be named by its binary name, which must meet the following constraints: 
> 
> 
> * The binary name of a top level type (§7.6) is its canonical name (§6.7).
> * [...]
> * The binary name of an anonymous class (§15.9.5) consists of the binary name of its immediately enclosing type, followed by $, followed by a non-empty sequence of digits.
> 
> 
> 

So in theory, it does not have to start at 1, but it has to be something like `EnclosingClass$N` where N is a number.
According to [this answer](https://stackoverflow.com/questions/1075207/what-are-the-1-in-class-file):

> 
> Note that the exact name of the files holding anonymous inner classes
>  is not standardized and might vary. But in practice I've yet to see
>  any other scheme than the one described here.
> 
> 
> 

So I guess there is no such guarantee.