content: package com.aitsuki.fix;
  
  import java.lang.reflect.Array;
  import java.lang.reflect.Field;
  
  /**
   * Created by hp on 2016/4/11.
   */
  public class ReflectUtil {
  
      public static Object getField(Class<?> cl, String fieldName, Object object) throws NoSuchFieldException, IllegalAccessException {
          Field field = cl.getDeclaredField(fieldName);
          field.setAccessible(true);
          return field.get(object);
      }
  
  
      public static void setField(Class<?> cl, String fieldName, Object object, Object value) throws NoSuchFieldException, IllegalAccessException {
          Field field = cl.getDeclaredField(fieldName);
          field.setAccessible(true);
          field.set(object, value);
      }
  
      public static Object combineArray(Object firstArr, Object secondArr) {
          int firstLength = Array.getLength(firstArr);
          int secondLength = Array.getLength(secondArr);
          int length = firstLength + secondLength;
  
          Class<?> componentType = firstArr.getClass().getComponentType();
          Object newArr = Array.newInstance(componentType, length);
          for (int i = 0; i < length; i++) {
              if (i < firstLength) {
                  Array.set(newArr, i, Array.get(firstArr, i));
              } else {
                  Array.set(newArr, i, Array.get(secondArr, i - firstLength));
              }
          }
          return newArr;
      }
  }
  