how to get the Polysemes of a word in wordnet or any other api?
There are several third-party Java APIs for WordNet listed here: http://wordnet.princeton.edu/wordnet/related-projects/#Java

In the past, I've used JWNL the most: http://sourceforge.net/projects/jwordnet/

The documentation for JWNL isn't great, but it should provide the functionality you need.