There's no "clean" way to do this; you will need to manually copy every entry.
A a = ...;
B copy = new B();
copy.elem1 = a.elem1;
copy.elem2 = a.elem2;
Alternatively, you could use reflection, but it's performance costly and somewhat unclear, and will fail if there is any inconsistencies between the classes' field definitions.
A a = ...;
B copy = new B();
for (Field field : a.getClass().getDeclaredFields()) {
Field copyField = copy.getClass().getDeclaredField(field.getName());
field.setAccessible(true);
copyField.setAccessible(true);
if (!field.getType().isPrimitive()) {
Object value = field.get(a);
field.set(copy, value);
} else if (field.getType().equals(int.class)) {
int value = field.getInt(a);
field.setInt(copy, value);
} else if { ... } // and so forth
}