private static Unsafe getUnsafe()
    {
        Unsafe instance;
        try
        {
            final Field field = Unsafe.class.getDeclaredField("theUnsafe");
            field.setAccessible(true);
            instance = (Unsafe) field.get(null);
        }
        catch (Exception ignored)
        {
            // Some platforms, notably Android, might not have a sun.misc.Unsafe implementation with a private
            // `theUnsafe` static instance. In this case we can try to call the default constructor, which is sufficient
            // for Android usage.
            try
            {
                Constructor<Unsafe> c = Unsafe.class.getDeclaredConstructor();
                c.setAccessible(true);
                instance = c.newInstance();
            }
            catch (Exception e)
            {
                throw new RuntimeException(e);
            }
        }
        return instance;
    }
Why should we resort to using Unsafe?<br>
<ol>
<li>To construct class fields which allow volatile/ordered/plain access: This requirement is covered by
{@link AtomicReferenceFieldUpdater} and similar but their performance is arguably worse than the DIY approach
(depending on JVM version) while Unsafe intrinsification is a far lesser challenge for JIT compilers.
<li>To construct flavors of {@link AtomicReferenceArray}.
<li>Other use cases exist but are not present in this library yet.
</ol>

@author nitsanw
jctools-core/src/main/java/org/jctools/util/UnsafeAccess.java