I think this if-else could be written as <pre>out.writeInt(isDeleted ? 1 : 0)</pre>