
import java.lang.reflect.Field;
import sun.misc.Unsafe;

public class UnsafeTest {
    
    public static void main(String[] args) throws Exception {
        //Unsafe unsafe = Unsafe.getUnsafe();
        Field f = Unsafe.class.getDeclaredField("theUnsafe");
        f.setAccessible(true);
        Unsafe unsafe = (Unsafe) f.get(null);

        System.out.println(unsafe.arrayBaseOffset(new int[0].getClass()));
        System.out.println(unsafe.arrayBaseOffset(new long[0].getClass()));
        System.out.println(unsafe.arrayBaseOffset(new Object[0].getClass()));
        System.out.println(unsafe.arrayBaseOffset(new Class<?>[0].getClass()));
        
        System.out.println(unsafe.arrayIndexScale(new int[0].getClass()));
        System.out.println(unsafe.arrayIndexScale(new long[0].getClass()));
        System.out.println(unsafe.arrayIndexScale(new Object[0].getClass()));
        System.out.println(unsafe.arrayIndexScale(new Class<?>[0].getClass()));
    }
    
}

@@ -156,10 +156,8 @@
     
-//
 Unsa
@@ -188,16 +188,18 @@
 safe();%0A
+//
         
@@ -252,16 +252,18 @@
 safe%22);%0A
+//
         
@@ -285,16 +285,18 @@
 (true);%0A
+//
         
@@ -333,17 +333,21 @@
 (null);%0A
-%0A
+//%0A//
         
@@ -405,32 +405,34 @@
 %5D.getClass()));%0A
+//
         System.o
@@ -483,32 +483,34 @@
 %5D.getClass()));%0A
+//
         System.o
@@ -563,32 +563,34 @@
 %5D.getClass()));%0A
+//
         System.o
@@ -645,32 +645,34 @@
 %5D.getClass()));%0A
+//
         %0A       
@@ -660,24 +660,26 @@
 %0A//        %0A
+//
         Syst
@@ -733,32 +733,34 @@
 %5D.getClass()));%0A
+//
         System.o
@@ -811,32 +811,34 @@
 %5D.getClass()));%0A
+//
         System.o
@@ -895,24 +895,26 @@
 tClass()));%0A
+//
         Syst
@@ -981,16 +981,124 @@
 ss()));%0A
+//        %0A//        Class cc = sun.reflect.Reflection.getCallerClass(1);%0A//        System.out.println(cc);%0A
     %7D%0A  

test Unsafe