code: private void encode(byte[] frame, int[] limits) {
      JSType.setCount(frame, limits, indices.length);
      for (int i = 0; i < indices.length; i++)
        JSType.setCount(frame, limits, indices[i]);
      JSType.setCount(frame, limits, varBias);
      JSType.setCount(frame, limits, setCases.length);
      for (int i = 0; i < setCases.length; i++) {
        int[] cases = setCases[i];
        if (cases == null)
          JSType.setCount(frame, limits, -1);
        else {
          JSType.setCount(frame, limits, cases.length);
          for (int j = 0; j < cases.length; j++)
            JSType.setCount(frame, limits, cases[j]);
        }
      }
      JSType.setCount(frame, limits, getCases.length);
      for (int i = 0; i < getCases.length; i++) {
        int[] cases = getCases[i];
        if (cases == null)
          JSType.setCount(frame, limits, -1);
        else {
          JSType.setCount(frame, limits, cases.length);
          for (int j = 0; j < cases.length; j++)
            JSType.setCount(frame, limits, cases[j]);
        }
      }
    }
docs: Encode subroutine used by toEncodedForm