public class HelloWorld { int data = 100; Sample sample = new Sample(); Sample s1; Sample s2; HelloWorld() { s1 = new Sample2(); s2 = new Sample2(); } private static native void testArray(int[] arr); private static native void testArrayRegion(int[] arr); private static native int[] createIntArray(); private static native String[] createObjectArray(String s1, String initial); private static native String testNewString(); private static native void testString(String s); private static native int static_sum(Sample s, int i, int j); private native int sum(Sample s, int i, int j); private native static Sample testConstructors(Sample s, Sample dummy); native long testLong(long l); public native void test(int i, int j, String s); public native void displayHelloWorld(); public native void exceptionTest(Exception e) throws Exception; static { System.loadLibrary("hello"); } long longJavaMethod() { System.out.println("longJavaMethod() called in Java side"); return -1000; } public static void main(String[] args) { HelloWorld hw = new HelloWorld(); hw.displayHelloWorld(); new HelloWorld().test(1, 10, "John"); hw.s2.run(10, 20, 30); int total = hw.sum(new Sample(), 10, 100); System.out.println("You expect to see 110 here: " + total); System.out.println("Calling constructors"); Sample s = testConstructors(new Sample(), null); System.out.println("You expect to see 100 here: " + s.data); System.out.println("You expect to see 1000 here: " + s.sData); System.out.println("Calling testNewString()"); String str = testNewString(); System.out.println(str); System.out.println("Calling testString()"); str = "This is Christina and John"; testString(str); // test array int[] a = {1, 2, 3, 4, 5}; System.out.println("testArray()"); System.out.println("Before: "); for (int i=0; i