;; 十进制计数法
(def n-decimal 42)
;; 八进制计数法
(def octal 042) ; octal is 34
(def octal2 8r52) ; octal2 is 42
;; 十六进制计数法
(def hexadecimal 0x42) ; hexadecimal is 66
(def hex2 16r2A) ; hex2 is 42
;; 二进制计数法
(def binary 2r1010) ; binary is 10
;; 2 到 36 之间任意进制的字符串
(def from-string (Integer/parseInt "2a" 16)) ; from-string is 42
;; 42 转成各进制的字符串
(def s-decimal (str 42)) ; "42"
(def s-octal (Long/toString 42 8)) ; "52"
(def s-hex (Long/toString 42 16)) ; "2a"
(def s-binary (Long/toString 42 2)) ; "101010"
(println n-decimal octal octal2 hexadecimal hex2 binary from-string)
(prn s-decimal s-octal s-hex s-binary)