public static void writeTo(IndentingWriter writer, long val) throws IOException { if (val < 0) { writer.write("-0x"); writer.printLongAsHex(-val); writer.write('L'); } else { writer.write("0x"); writer.printLongAsHex(val); writer.write('L'); } }
public static void writeSignedIntOrLongTo(IndentingWriter writer, long val) throws IOException { if (val < 0) { writer.write("-0x"); writer.printLongAsHex(-val); if (val < Integer.MIN_VALUE) { writer.write('L'); } } else { writer.write("0x"); writer.printLongAsHex(val); if (val > Integer.MAX_VALUE) { writer.write('L'); } } }