Skip to content

Instantly share code, notes, and snippets.

@massimilianochiodi
Created April 15, 2022 09:34
Show Gist options
  • Save massimilianochiodi/842e606ca7e4cd324d7d7a83fe9fda2f to your computer and use it in GitHub Desktop.
Save massimilianochiodi/842e606ca7e4cd324d7d7a83fe9fda2f to your computer and use it in GitHub Desktop.
Get dword 16bit from integer(signed) array (java)
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