### Question:
AbstractMatrix implements Matrix { public static int [] getCommonIndices(int [] indices_a, final int len_a, int [] indices_b, final int len_b) { ArrayList<Integer> common = new ArrayList<Integer>(); int i = 0; int j = 0; while (i < len_a && j < len_b) { if (indices_a[i] == indices_b[j]) { common.add(indices_a[i]); i += 1; j += 1; } else if (indices_a[i] < indices_b[j]) { i += 1; } else { j += 1; } } int [] result = new int[common.size()]; for (int k=0; k<result.length; k++) { result[k] = common.get(k); } return result; }  void scale(final double a); void setAll(final double a); void add(Matrix B); void add(double a, Matrix B); double elementSum(); double elementMultiplySum(Matrix m); void CG(Vector x, Vector y); void QR(Vector x, Vector y); Vector rowSums(); Vector columnSums(); void rowSums(double [] result); void columnSums(double [] result); void setToMaxTranspose(); void multAdd(double alpha, Vector x, Vector y); void mult(Vector x, Vector y); void dotDivOuterProd(Vector x); Matrix subMatrix(int [] rows, int [] cols); MatrixCursor columnCursor(int colIndex); MatrixCursor rowCursor(int rowIndex); void add(int i, int j, double alpha); void multAdd(double [] x, double [] y); void transMult(double [] x, double [] y); void compact(); static int [] getCommonIndices(int [] indices_a, final int len_a, int [] indices_b, final int len_b); static int [] getPositionsOfCommonIndicesOfAInB(int [] indices_a, final int len_a, int [] indices_b, final int len_b); @Override MatrixAccumulator accumulator(); void mmwrite(String filename); Matrix mmread(String filename);  }### Answer:
@Test public void testGetCommonIndices() { int [] a = {1, 2, 7}; int [] b = {2, 7, 8}; int [] c = {3, 4, 9}; int [] common = AbstractMatrix.getCommonIndices(a, a.length, b, b.length); assertEquals(2, common.length); assertEquals(2, common[0]); assertEquals(7, common[1]); common = AbstractMatrix.getCommonIndices(b, b.length, a, a.length); assertEquals(2, common.length); assertEquals(2, common[0]); assertEquals(7, common[1]); common = AbstractMatrix.getCommonIndices(a, a.length, c, c.length); assertEquals(0, common.length); }