code: public static final void appendState(StringBuilder sb, short bits) {
          // These 3 states are mutually exclusive.
          if ((bits & TaskState.SCHEDULED.bit) != 0)
              sb.append(TaskState.SCHEDULED.name()).append(',');
          if ((bits & TaskState.ENDED.bit) != 0)
              sb.append(TaskState.ENDED.name()).append(',');
          if ((bits & TaskState.SUSPENDED.bit) != 0)
              sb.append(TaskState.SUSPENDED.name()).append(',');
  
          // Other states that can be combined with the above
          if ((bits & TaskState.UNATTEMPTED.bit) != 0)
              sb.append(TaskState.UNATTEMPTED.name()).append(',');
          if ((bits & TaskState.SKIPPED.bit) != 0)
              sb.append(TaskState.SKIPPED.name()).append(',');
          if ((bits & TaskState.SKIPRUN_FAILED.bit) != 0)
              sb.append(TaskState.SKIPRUN_FAILED.name()).append(',');
          if ((bits & TaskState.FAILURE_LIMIT_REACHED.bit) != 0)
              sb.append(TaskState.FAILURE_LIMIT_REACHED.name()).append(',');
          if ((bits & TaskState.CANCELED.bit) != 0)
              sb.append(TaskState.CANCELED.name()).append(',');
          sb.deleteCharAt(sb.length() - 1);
      }
docs: Prints a state.
  
  @param sb buffer for output.
  @param bits state bits.
  @return the buffer