public static void writeSetOfLongs(Set set, boolean hasLongIDs, DataOutput out)
      throws IOException {
    if (set == null) {
      out.writeInt(-1);
    } else {
      out.writeInt(set.size());
      out.writeBoolean(hasLongIDs);
      for (Object aSet : set) {
        Long l = (Long) aSet;
        if (hasLongIDs) {
          out.writeLong(l);
        } else {
          out.writeInt((int) l.longValue());
        }
      }
    }
  }
write a set of Long objects

@param set the set of Long objects
@param hasLongIDs if false, write only ints, not longs
@param out the output stream
geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java