private CstArray makeStaticValuesConstant() {
    // First sort the statics into their final order.
    Collections.sort(staticFields);

    /*
     * Get the size of staticValues minus any trailing zeros/nulls (both
     * nulls per se as well as instances of CstKnownNull).
     */

    int size = staticFields.size();
    while (size > 0) {
      EncodedField field = staticFields.get(size - 1);
      Constant cst = staticValues.get(field);
      if (cst instanceof CstLiteralBits) {
        // Note: CstKnownNull extends CstLiteralBits.
        if (((CstLiteralBits) cst).getLongBits() != 0) {
          break;
        }
      } else if (cst != null) {
        break;
      }
      size--;
    }

    if (size == 0) {
      return null;
    }

    // There is something worth encoding, so build up a result.

    CstArray.List list = new CstArray.List(size);
    for (int i = 0; i < size; i++) {
      EncodedField field = staticFields.get(i);
      Constant cst = staticValues.get(field);
      if (cst == null) {
        cst = Zeroes.zeroFor(field.getRef().getType());
      }
      list.set(i, cst);
    }
    list.setImmutable();

    return new CstArray(list);
  }
Gets a {@link CstArray} corresponding to {@link #staticValues} if it contains any non-zero
non-{@code null} values.

@return {@code null-ok;} the corresponding constant or {@code null} if there are no values to
    encode
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/file/ClassDataItem.java