1) check this simple code of Jpair: https://personal.cis.strath.ac.uk/changyu.dong/jpair/intro.html
2) pairing operations with JPBC work quite similar. But, if you need to enhance the performance of pairing operations then the pure PBC lib (https://crypto.stanford.edu/pbc/download.html) is better choice. (Another good option > MIRACL)