Skip to content

Instantly share code, notes, and snippets.

@maximn
Created November 10, 2015 09:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maximn/b36a643be9afb24dd84a to your computer and use it in GitHub Desktop.
Save maximn/b36a643be9afb24dd84a to your computer and use it in GitHub Desktop.
Bit array string representation of a Scala BitSet
implicit class BitMaskExtensions(bitSet: BitSet) {
def toBitArrayString: String = {
val seq = (0 to bitSet.max) map { x => if (bitSet.contains(x)) "1" else "0"}
"[" + seq.mkString(",") + "]"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment