code: public static void copyMemoryFieldByField(long srcAddress, Object dest) {
  
      Class clazz = dest.getClass();
      while (clazz != Object.class) {
        for (Field f : clazz.getDeclaredFields()) {
          if ((f.getModifiers() & Modifier.STATIC) == 0) {
            final Class type = f.getType();
  
            // TODO maybe support Wrapper classes
            Preconditions.checkArgument(type.isPrimitive(), "Only primitives are supported");
  
            final long offset = unsafe.objectFieldOffset(f);
            final long src = srcAddress + offset;
  
            if (type == int.class) {
              unsafe.putInt(dest, offset, unsafe.getInt(src));
  
            } else if (type == long.class) {
              unsafe.putLong(dest, offset, unsafe.getLong(src));
  
            } else {
              throw new IllegalArgumentException("Type not supported yet: " + type);
            }
          }
        }
        clazz = clazz.getSuperclass();
      }
    }
docs: Copies from srcAddress to dest one field at a time.
  
  @param srcAddress
  @param dest