Not really, you should use a WSN simulator for this purpose. For more details, kindly read this article: https://www.researchgate.net/publication/234018317_A_Performance_Comparison_of_Open_Source_Network_Simulators_for_Wireless_Networks
Conference Paper A Performance Comparison of Open Source Network Simulators f...
As it was mentioned above, It really depends on what are you trying to do.
If it is a simple scenario with few nodes just to investigate or to demonstrate a specific idea so Java would be a good choice. But for more complex scenario mainstream network simulators are more capable to address you problem, because most of the familiar network protocols are already implemented and ready to be used in your work. Which give you the time and energy to focus on the problem in hand.
JSIM is a good one but it depends on which kind of WSN you would like to simulate. Personally, I recommend you to check another JAVA-based tool, COOJA of Contiki platform, which includes both simulator and hardware emulator.