Programming languages should have no trouble with this task; here's one way to pack 64-bit integers (big or little endian) and native 32, 16, and 8-bit from a list of numbers in the input
$ cat input
-1
2
$ < input perl -pe '$_=pack "q>",$_' | xxd
00000000: ffff ffff ffff ffff 0000 0000 0000 0002 ................
$ < input perl -pe '$_=pack "q<",$_' | xxd
00000000: ffff ffff ffff ffff 0200 0000 0000 0000 ................
$ < input perl -pe '$_=pack "l",$_' | xxd
00000000: ffff ffff 0200 0000 ........
$ < input perl -pe '$_=pack "s",$_' | xxd
00000000: ffff 0200 ....
$ < input perl -pe '$_=pack "c",$_' | xxd
00000000: ff02 ..
$
The other way requires knowing what the binary has been written as as otherwise the numbers can come out all wrong
$ jot 255 | perl -pe '$_=pack "l>",$_' > 32big
$ < 32big perl -nE 'say for unpack "l*",$_' | head -3
16777216
33554432
50331648
$ < 32big perl -nE 'say for unpack "l>*",$_' | head -3
1
2
3
$