From http://dl.dropboxusercontent.com/u/1961549/StackOverflow/SO1456930/ClassDiscovery.java