private static void processFields(String packetName, List<PacketFieldType> fields, JDefinedClass packetClass, JCodeModel codeModel, boolean fromClient) throws JClassAlreadyExistsException {
AtomicInteger numberOfUnknowns = new AtomicInteger();
JClass arrays = codeModel.ref(Arrays.class);
JClass stringBuilder = codeModel.ref(StringBuilder.class);
JMethod toStringMethod = packetClass.method(JMod.PUBLIC, String.class, "toString");
toStringMethod.annotate(Override.class);
JBlock toStringMethodBody = toStringMethod.body();
JVar stringBuilderVar = toStringMethodBody.decl(stringBuilder, "sb");
stringBuilderVar = stringBuilderVar.init(JExpr._new(stringBuilder).arg(packetName + "["));
JInvocation appendChain = null;