public Mode.Bits toModeBits() {
    Mode.Bits bits = Mode.Bits.NONE;
    if (contains(AclAction.READ)) {
      bits = bits.or(Mode.Bits.READ);
    }
    if (contains(AclAction.WRITE)) {
      bits = bits.or(Mode.Bits.WRITE);
    }
    if (contains(AclAction.EXECUTE)) {
      bits = bits.or(Mode.Bits.EXECUTE);
    }
    return bits;
  }
@Test
  public void toModeBits() {
    AclActions actions = new AclActions();
    assertEquals(Mode.Bits.NONE, actions.toModeBits());

    actions = new AclActions();
    actions.add(AclAction.READ);
    assertEquals(Mode.Bits.READ, actions.toModeBits());

    actions = new AclActions();
    actions.add(AclAction.WRITE);
    assertEquals(Mode.Bits.WRITE, actions.toModeBits());

    actions = new AclActions();
    actions.add(AclAction.EXECUTE);
    assertEquals(Mode.Bits.EXECUTE, actions.toModeBits());

    actions = new AclActions();
    actions.add(AclAction.READ);
    actions.add(AclAction.WRITE);
    assertEquals(Mode.Bits.READ_WRITE, actions.toModeBits());

    actions = new AclActions();
    actions.add(AclAction.READ);
    actions.add(AclAction.EXECUTE);
    assertEquals(Mode.Bits.READ_EXECUTE, actions.toModeBits());

    actions = new AclActions();
    actions.add(AclAction.WRITE);
    actions.add(AclAction.EXECUTE);
    assertEquals(Mode.Bits.WRITE_EXECUTE, actions.toModeBits());

    actions = new AclActions();
    actions.add(AclAction.READ);
    actions.add(AclAction.WRITE);
    actions.add(AclAction.EXECUTE);
    assertEquals(Mode.Bits.ALL, actions.toModeBits());
  }