code: public static Integer toInteger(Object v) {
          if (v == null) {
              return null;
          }
          if (v instanceof Boolean) {
              return ((Boolean) v) ? 1 : 0;
          }
          return ((Number) v).intValue();
      }
docs: Converts safely any Number to Integer.
  
  @param v
  @return