How to get the max sizes of the heap and permgen from the JVM?-Collection of common programming errors

I am trying to find out programatically the max permgen and max heap size with which a the JVM for my program has been invoked, not what is currently available to them.

Is there a way to do that?

I am familiar with the methods in Java Runtime object, but its not clear what they really deliver.

Alternatively, is there a way to ask Eclipse how much was allocated for these two?