1 /* 2 * Copyright (C) 2006 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.debug; 18 19 /** 20 * Simple JNI verification test. 21 */ 22 public class JNITest { 23 JNITest()24 public JNITest() { 25 } 26 test(int intArg, double doubleArg, String stringArg)27 public int test(int intArg, double doubleArg, String stringArg) { 28 int[] intArray = { 42, 53, 65, 127 }; 29 30 return part1(intArg, doubleArg, stringArg, intArray); 31 } 32 part1(int intArg, double doubleArg, String stringArg, int[] arrayArg)33 private native int part1(int intArg, double doubleArg, String stringArg, 34 int[] arrayArg); 35 part2(double doubleArg, int fromArray, String stringArg)36 private int part2(double doubleArg, int fromArray, String stringArg) { 37 int result; 38 39 System.out.println(stringArg + " : " + (float) doubleArg + " : " + 40 fromArray); 41 result = part3(stringArg); 42 43 return result + 6; 44 } 45 part3(String stringArg)46 private static native int part3(String stringArg); 47 } 48 49