On the bittorent API page:
A simple and easy to use API that should allow any developer to create new JAVA applications that require the use of the Bittorrent protocol. The examples presented show a very simple torrent creator and publisher, client and Bittorrent tracker.
What you are looking for should be in the sample code.
Further reading:
source share