incorporating some code from the thebreakfastpost.com "wrapping a c library with jni"