Created
April 15, 2022 09:34
-
-
Save massimilianochiodi/842e606ca7e4cd324d7d7a83fe9fda2f to your computer and use it in GitHub Desktop.
Get dword 16bit from integer(signed) array (java)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String word16bit(int[] listabit) { | |
StringBuilder result = new StringBuilder(); | |
for (int value : listabit) { | |
int b2 = value & 0xff; | |
int b1 = (value >> 8) & 0xff; | |
if (b2 == 0) { | |
return result.toString(); | |
} else { | |
result.append( (char) b2 ); | |
} | |
if (b1 == 0) { | |
return result.toString(); | |
} else { | |
result.append( (char) b1 ); | |
} | |
} | |
return result.toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment