I have checked all this afternoon, can't figure out the reason.
Here is my test code :
As you see, I want to change the Key(i) always to be the Positive value, but failed ~
Any help is Welcome ,Thank you!
Here is my test code :
B4X:
Dim key(9) As Byte
key=Array As Byte(-24,43,-53,67,78,82,91,245,218,190)
Dim mstr="dsfsdfsdfsdf"
Dim k As Int=0,j As Int=0
For i = 0 To key.Length-1
If key(i)<0 Then
Log("err" & " " & i & key(i))
key(i)=Bit.And(0xFF,key(i))
Log("c " & key(i))
End If
k = key(i) / mstr.Length
j = key(i) Mod mstr.Length
Log("k=" & k & "j=" & j & "i=" & i & "key(i)=" & key(i))
Next
As you see, I want to change the Key(i) always to be the Positive value, but failed ~
Any help is Welcome ,Thank you!