问题
I see it's simple to convert golang's big int (math/big package) to a string, but is there any straightforward way of converting a big int to a binary string?
回答1:
Should be as easy as this:
i := big.NewInt(2014)
s := fmt.Sprintf("%b", i) // 11111011110
fmt.Println(s)
Hope this is what you are looking for.
来源:https://stackoverflow.com/questions/23317336/golang-big-integers-to-binary-string