And do you want to do this by just reading the .java file? For at least some programs, that's impossible. Or would it be acceptable to run the program, and count how many threads actually exist at a particular time?
I am not sure how you can figure the threads created by a particular code block. I was thinking about stack trace but stack trace is per thread and not across threads. So, it's not possible to know where it was spawned.
If your threads are named (or you could induce code to name them at the point they are created), you could probably iterate through the list of threads to check. But I am not sure you want to/can do that.
If you explain why you need to do this, we may be able to offer an alternative.