B4A send to vb6 :value a as long=165814
need bytes():182,135,2,0
but b4a send is:-74/-121/2/0
how to fix?
B4X:
Dim v As Long = Bit.And(value, 0xFFFFFFFF)
Dim b0 As Byte = Bit.And(v, 0xFF)
Dim b1 As Byte = Bit.And(Bit.UnsignedShiftRight(v, 8), 0xFF)
Dim b2 As Byte = Bit.And(Bit.UnsignedShiftRight(v, 16), 0xFF)
Dim b3 As Byte = Bit.And(Bit.UnsignedShiftRight(v, 24), 0xFF)
They are the same - its just how java has signed bytes - your code will show the same with a minor tweak
B4X:
Dim v As Long = Bit.And(value, 0xFFFFFFFF)
Dim i_b0 As Int = Bit.And(v, 0xFF)
Dim i_b1 As Int = Bit.And(Bit.UnsignedShiftRight(v, 8), 0xFF)
Dim i_b2 As Int = Bit.And(Bit.UnsignedShiftRight(v, 16), 0xFF)
Dim i_b3 As Int = Bit.And(Bit.UnsignedShiftRight(v, 24), 0xFF)
Log( $" ${i_b3}, ${i_b2}, ${i_b1}, ${i_b0}")