Java code for The Core