store/[org.clojure/clojure "1.8.0"] clj::clojure.core/bit-and

Official Documentation

Add notes
Arities
==================================================
   [x y]
   [x y & more]

Docstring
==================================================
  Bitwise and

Source

(defn bit-and
  "Bitwise and"
   {:inline (nary-inline 'and)
    :inline-arities >1?
    :added "1.0"}
   ([x y] (. clojure.lang.Numbers and x y))
   ([x y & more]
      (reduce1 bit-and (bit-and x y) more)))

Example 1

Edit
(bit-and 0x08 0xFF)
;; => 8

Example 2

Edit
(bit-and 2r1100 2r1001)
;; => 8

;; 8 = 2r1000

;; the same in decimal
(bit-and 12 9)
;; => 8

Example 3

Edit
(Integer/toBinaryString 235)
;; => "11101011"

(Integer/toBinaryString 199)
;; => "11000111"

(bit-and 235 199)
;; => 195

(Integer/toBinaryString 195)
;; => "11000011"

;;11101011
;;&
;;11000111
;;=
;;11000011

Uses on crossclj