A google search for "java native methods" will get you introductory articles on what it takes for a
Java program to call a native method.
Note that
you should NEVER put complex and hard to debug code like this directly in a JSP page. Create a helper class that can be debugged by itself outside the servlet/jsp environment.
Bill