This repository contains code samples from http://www.browserstack.com/automate/java. Please feel free to clone the repo and use the example code.
Do remember to switch the USERNAME and ACCESS_KEY with your own browserstack credentials.
For frameworks integration with BrowserStack, refer to their individual repositories -