Unsafe is stored as a private field that cannot be accessed directly. The constructor is private and the only method to access public static Unsafe getUnsafe() has privileged access. By use of reflection, there is a work-around to make private fields accessible:
public static final Unsafe UNSAFE;
static {
Unsafe unsafe = null;
try {
final PrivilegedExceptionAction<Unsafe> action="/?originalUrl=https%3A%2F%2Friptutorial.com%2F()%2520-%26gt%3B%2520%257B%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520final%2520Field%2520f%2520%3D%2520Unsafe.class.getDeclaredField(%26quot%3BtheUnsafe%26quot%3B)%3B%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520f.setAccessible(true)%3B%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520return%2520(Unsafe)%2520f.get(null)%3B%2520%2520%2520%2520%2520%2520%2520%2520%257D%3B%2520%2520%2520%2520%2520%2520%2520%2520unsafe%2520%3D%2520AccessController.doPrivileged(action)%3B%2520%2520%2520%2520%257D%2520catch%2520(final%2520Throwable%2520t)%2520%257B%2520%2520%2520%2520%2520%2520%2520%2520throw%2520new%2520RuntimeException(%26quot%3BException%2520accessing%2520Unsafe%26quot%3B%2C%2520t)%3B%2520%2520%2520%2520%257D%2520%2520%2520%2520UNSAFE%2520%3D%2520unsafe%3B%257D%253C%2Fcode">