Standard library / math/big

big.Int.Bytes()

Return the unsigned absolute magnitude in big-endian bytes; sign is not encoded. Expected stdout: '[1 2]\n'.

Formal Syntax & Structure

go syntaxgo
func (x *Int) Bytes() []byte

Return Value

[]byte

Returns the result described above; see the example for the observed behavior.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func main() {  fmt.Println(big.NewInt(-258).Bytes())}
Go Reference