grazie della risposta immediata alka,
girando un pò ho visto che in Java non è una cosa semplicissima

da http://www.faqs.org/faqs/computer-la...k-programming/
3.5 How do I implement PING in Java?

Java includes support for UDP and TCP sockets. PING
requires support for the Internet Control Message Protocol
(ICMP). Your only choice (at the moment), is to use native
code, or to use java.lang.Runtime to execute an external
ping application. You won't be able to develop a 100% Pure
implementation.

NB - A native implementation that uses the Java Native
Interface (JNI) is available for PING, in both English and
Spanish. For more details, see
http://www.geocities.com/SiliconValley/Bit/5716/ping/

magari mi butterò sul C col quale ho visto molte implementazioni