public static FenwickTree fenwickTree(long[] A) {
   FenwickTree fw = new FenwickTree(A.length);
   for (int i = 0; i < A.length; i++) {
     fw.addValue(i + 1, A[i]);
   }
   return fw;
 }
 @Test
 public void testAddValue() {
   int n = 2000;
   FenwickTree fw = new FenwickTree(n);
   long[] A = randomArray(n);
   for (int i = 0; i < A.length; i++) {
     fw.addValue(i + 1, A[i]);
   }
   long[] B = fw.toArray();
   assertArrayEquals(A, B);
 }