Skip to content

Instantly share code, notes, and snippets.

@lion328
Last active August 29, 2015 14:09
Show Gist options
  • Save lion328/00e174cb4f4fdbecc9f2 to your computer and use it in GitHub Desktop.
Save lion328/00e174cb4f4fdbecc9f2 to your computer and use it in GitHub Desktop.
NCN CUR reader
public static int[] readNcnCur(File f) throws IOException {
DataInputStream in = new DataInputStream(new FileInputStream(f));
int[] out = new int[(int)Math.ceil(f.length() / 2)];
int i = 0;
while(in.available() > 0) {
int temp = in.readUnsignedByte();
int byte2 = in.readUnsignedByte();
if(byte2 != 255) {
temp += byte2 << 8;
out[i++] = temp;
}
}
in.close();
return out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment