@Test public void testToIntArray() throws Exception { Assert.assertEquals(0, ArrayMath.toIntArray(Collections.EMPTY_LIST).length); Assert.assertArrayEquals(new int[] {0}, ArrayMath.toIntArray(Arrays.asList(0))); Assert.assertArrayEquals(new int[] {0, 1, -2, -3, 4}, ArrayMath.toIntArray(Arrays.asList(0, 1, -2, -3, 4))); }
public static int[] toIntArray(List<Integer> list) { int[] arr = new int[list.size()]; for (int i = 0; i < arr.length; i++) { arr[i] = list.get(i); } return arr; }
ArrayMath { public static int[] toIntArray(List<Integer> list) { int[] arr = new int[list.size()]; for (int i = 0; i < arr.length; i++) { arr[i] = list.get(i); } return arr; } }
ArrayMath { public static int[] toIntArray(List<Integer> list) { int[] arr = new int[list.size()]; for (int i = 0; i < arr.length; i++) { arr[i] = list.get(i); } return arr; }  }
ArrayMath { public static int[] toIntArray(List<Integer> list) { int[] arr = new int[list.size()]; for (int i = 0; i < arr.length; i++) { arr[i] = list.get(i); } return arr; }  static double innerProduct(double[] vecA, double[] vecB); static double l1norm(double[] v); static double l2norm(double[] v); static double invL2norm(double[] v); static double logSumOfExps(double[] x); static double max(double[] x); static int argmax(double[] x); static void sumFeatures(Context[] context, float[] values, double[] prior); static double[] toDoubleArray(List<Double> list); static int[] toIntArray(List<Integer> list); }
ArrayMath { public static int[] toIntArray(List<Integer> list) { int[] arr = new int[list.size()]; for (int i = 0; i < arr.length; i++) { arr[i] = list.get(i); } return arr; }  static double innerProduct(double[] vecA, double[] vecB); static double l1norm(double[] v); static double l2norm(double[] v); static double invL2norm(double[] v); static double logSumOfExps(double[] x); static double max(double[] x); static int argmax(double[] x); static void sumFeatures(Context[] context, float[] values, double[] prior); static double[] toDoubleArray(List<Double> list); static int[] toIntArray(List<Integer> list);  }