Show-Header Starting with this number: $number = 26443007 $number
Show-Header Display the bits for this number: $bits = [Convert]::ToString($number,2) $bits
Show-Header Add missing leading zeroes: # pad the string to its full bit range (32 bits) $bitsAligned = $bits.PadLeft(32, '0') $bitsAligned
Show-Header Display the four byte groups $bitsAligned-split'(?<=\G.{8})(?=.)'-join'-'
Show-Header Get the bytes by conversion to IPAddress object: $bytes = ([Net.IPAddress]$number).GetAddressBytes() $bytes
Show-Header Display the bits for the IPAddress bytes: $bitbytes = $bytes | ForEach-Object { [Convert]::ToString($_, 2).PadLeft(8,'0')} $bitbytes-join'-'
Show-Header Show the Least Significant Byte LSB: $bytes[0]
Show-Header Show LSB by turning the 8 bits to the right into a number to verify: $bits = [Convert]::ToString($number, 2) # take least significant bits [Convert]::toByte($bits.Substring($bits.Length-8),2)
Show-Header Show the Most Significant Byte MSB: $bytes[3]
===========================Starting with this number:===========================
26443007
=======================Display the bits for this number:========================
1100100110111110011111111
===========================Add missing leading Zeroes:==========================
00000001100100110111110011111111
==========================Display the four byte groups==========================
00000001-10010011-01111100-11111111
================Get the bytes by conversion to IPAddress object:================
255
124
147
1
===================Display the bits for the IPAddress bytes:====================
11111111-01111100-10010011-00000001
======================Show the Least Significant Byte LSB:======================
255
======Show LSB by turning the 8 bits to the right into a number to verify:======
255
=======================Show the Most Significant Byte MSB:======================
1