This language bar is your friend. Select your favorite languages!
Edit summary for version 35 :
[Go]+DocURL to strconv.FormatInt

Version 34

Version 35

Idiom #76 Binary digits from an integer

Create the string s of integer x written in base 2.

E.g. 13 -> "1101"

Idiom #76 Binary digits from an integer

Create the string s of integer x written in base 2.

E.g. 13 -> "1101"

Imports
import "strconv"
Imports
import "strconv"
Code
s := strconv.FormatInt(x, 2)
Code
s := strconv.FormatInt(x, 2)
Comments bubble
Here x has type int64.

For very big numbers, prefer type *big.Int.
Comments bubble
Here x has type int64.

For very big numbers, prefer type *big.Int.
Doc URL
https://golang.org/pkg/strconv/#FormatInt
Origin
http://stackoverflow.com/a/13870865/871134
Origin
http://stackoverflow.com/a/13870865/871134
Demo URL
http://play.golang.org/p/Puc5oe4Lv5
Demo URL
http://play.golang.org/p/Puc5oe4Lv5