code: public void transform(double[] a) {
          int n = a.length;
  
          if (!Math.isPower2(n)) {
              throw new IllegalArgumentException("The data vector size is not a power of 2.");
          }
  
          if (n < ncof) {
              throw new IllegalArgumentException("The data vector size is less than wavelet coefficient size.");
          }
  
          for (int nn = n; nn >= ncof; nn >>= 1) {
              forward(a, nn);
          }
      }
docs: Discrete wavelet transform.