Your best bet is probably to use a service such at
blockchain.info to gather stats. You'll have to make an HTTP request and parse the result with some JSON module.
If you do ever want to interact with the mainline client directly, it's easily as simple, because bitcoind support a JSON-RPC interface. The wiki even has
Java-specific information.
hi thanks for the response, yes i am looking for a direct connection to the p2p network not via a third party. For example how does blockchain.info get its stats? I can code the api myself in java but just confused as to how to go about getting stats on the network, dont want to have a dependency on a third party website (third party api jar files are ok but i cant find any).
for example
public static long getCurrentDifficulty()
{
//what are some of the high level steps i have to do?
}