Tabnine Logo
Integer.decode
Code IndexAdd Tabnine to your IDE (free)

How to use
decode
method
in
java.lang.Integer

Best Java code snippets using java.lang.Integer.decode (Showing top 20 results out of 5,103)

origin: google/guava

@Override
protected Integer doForward(String value) {
 return Integer.decode(value);
}
origin: prestodb/presto

@Override
protected Integer doForward(String value) {
 return Integer.decode(value);
}
origin: commons-lang/commons-lang

/**
 * <p>Convert a <code>String</code> to a <code>Integer</code>, handling
 * hex and octal notations.</p>
 * 
 * @param val  a <code>String</code> to convert
 * @return converted <code>Integer</code>
 * @throws NumberFormatException if the value cannot be converted
 */
public static Integer createInteger(String val) {
  // decode() handles 0xAABD and 0777 (hex and octal) as well.
  return Integer.decode(val);
}
origin: google/j2objc

@Override
protected Integer doForward(String value) {
 return Integer.decode(value);
}
origin: org.apache.commons/commons-lang3

/**
 * <p>Convert a <code>String</code> to a <code>Integer</code>, handling
 * hex (0xhhhh) and octal (0dddd) notations.
 * N.B. a leading zero means octal; spaces are not trimmed.</p>
 *
 * <p>Returns <code>null</code> if the string is <code>null</code>.</p>
 *
 * @param str  a <code>String</code> to convert, may be null
 * @return converted <code>Integer</code> (or null if the input is null)
 * @throws NumberFormatException if the value cannot be converted
 */
public static Integer createInteger(final String str) {
  if (str == null) {
    return null;
  }
  // decode() handles 0xAABD and 0777 (hex and octal) as well.
  return Integer.decode(str);
}
origin: commons-lang/commons-lang

/**
 * <p>Convert a <code>String</code> to a <code>Integer</code>, handling
 * hex and octal notations.</p>
 *
 * <p>Returns <code>null</code> if the string is <code>null</code>.</p>
 * 
 * @param str  a <code>String</code> to convert, may be null
 * @return converted <code>Integer</code>
 * @throws NumberFormatException if the value cannot be converted
 */
public static Integer createInteger(String str) {
  if (str == null) {
    return null;
  }
  // decode() handles 0xAABD and 0777 (hex and octal) as well.
  return Integer.decode(str);
}
origin: org.apache.ant/ant

/**
 * Constructor used by Ant's introspection mechanism for attribute population
 * @param value the value to decode
 */
public FlexInteger(String value) {
  this.value = Integer.decode(value);
}
origin: JetBrains/ideavim

@Nullable
protected Integer asNumber(String val) {
 try {
  return Integer.decode(val);
 }
 catch (NumberFormatException e) {
  return null;
 }
}
origin: wildfly/wildfly

  public Integer parseValue(final String string, final ClassLoader classLoader) throws IllegalArgumentException {
    return Integer.decode(string.trim());
  }
});
origin: springside/springside4

/**
 * 将16进制的String转化为Integer.
 * 
 * 当str为空或非数字字符串时抛NumberFormatException
 */
public static Integer hexToIntObject(@NotNull String str) {
  // 统一行为,不要有时候抛NPE,有时候抛NumberFormatException
  if (str == null) {
    throw new NumberFormatException("null");
  }
  return Integer.decode(str);
}
origin: JesusFreke/smali

  @Override
  public void startElement(String uri, String localName, String qName,
               Attributes attr) throws SAXException {
    if (qName.equals("public")) {
      String resourceType = attr.getValue("type");
      String resourceName = attr.getValue("name").replace('.', '_');
      Integer resourceId = Integer.decode(attr.getValue("id"));
      String qualifiedResourceName =
          String.format("%s.%s.%s", prefix, resourceType, resourceName);
      resourceIds.put(resourceId, qualifiedResourceName);
    }
  }
});
origin: springside/springside4

/**
 * 将16进制的String转化为Integer,出错时返回默认值.
 */
public static Integer hexToIntObject(@Nullable String str, Integer defaultValue) {
  if (StringUtils.isEmpty(str)) {
    return defaultValue;
  }
  try {
    return Integer.decode(str);
  } catch (final NumberFormatException nfe) {
    return defaultValue;
  }
}
origin: hibernate/hibernate-orm

public Integer getInteger(String query, String hintName) {
  String value = (String) hintsMap.get( hintName );
  if ( value == null ) {
    return null;
  }
  try {
    return Integer.decode( value );
  }
  catch ( NumberFormatException nfe ) {
    throw new AnnotationException( "Not an integer in hint: " + query + ":" + hintName, nfe );
  }
}
origin: com.h2database/h2

private long getDefaultMaxLength() {
  return 1L << Integer.decode(parse(name)[0]).intValue();
}
origin: com.h2database/h2

/**
 * Returns the value as an int.
 *
 * @param columnIndex (1,2,...)
 * @return the value
 */
@Override
public int getInt(int columnIndex) throws SQLException {
  Object o = get(columnIndex);
  if (o != null && !(o instanceof Number)) {
    o = Integer.decode(o.toString());
  }
  return o == null ? 0 : ((Number) o).intValue();
}
origin: twosigma/beakerx

 public static Color decode(String nm) throws NumberFormatException {
  Integer intval = Integer.decode(nm);
  int i = intval;
  return new Color((i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF);
 }
}
origin: plantuml/plantuml

private int parseInt(String value, String key) {
 try {
  return Integer.decode(value).intValue();
 } catch (NumberFormatException e) {
  throw createNumberFormatException("number", value, key);
 }
}
origin: jenkinsci/jenkins

  return Integer.decode(v);
} catch (NumberFormatException e) {
origin: com.h2database/h2

/**
 * Get the setting for the given key.
 *
 * @param key the key
 * @param defaultValue the default value
 * @return the setting
 */
protected int get(String key, int defaultValue) {
  String s = get(key, "" + defaultValue);
  try {
    return Integer.decode(s);
  } catch (NumberFormatException e) {
    throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1,
        e, "key:" + key + " value:" + s);
  }
}
origin: com.h2database/h2

/**
 * Get the value of the given property.
 *
 * @param setting the setting id
 * @param defaultValue the default value
 * @return the value as an integer
 */
int getIntProperty(int setting, int defaultValue) {
  String key = SetTypes.getTypeName(setting);
  String s = getProperty(key, null);
  try {
    return s == null ? defaultValue : Integer.decode(s);
  } catch (NumberFormatException e) {
    return defaultValue;
  }
}
java.langIntegerdecode

Javadoc

Parses the specified string and returns a Integer instance if the string can be decoded into an integer value. The string may be an optional minus sign "-" followed by a hexadecimal ("0x..." or "#..."), octal ("0..."), or decimal ("...") representation of an integer.

Popular methods of Integer

  • parseInt
    Parses the specified string as a signed integer value using the specified radix. The ASCII character
  • toString
    Converts the specified signed integer into a string representation based on the specified radix. The
  • valueOf
    Parses the specified string as a signed integer value using the specified radix.
  • intValue
    Gets the primitive value of this int.
  • <init>
    Constructs a new Integer from the specified string.
  • toHexString
    Returns a string representation of the integer argument as an unsigned integer in base 16.The unsign
  • equals
    Compares this instance with the specified object and indicates if they are equal. In order to be equ
  • compareTo
    Compares this Integer object to another object. If the object is an Integer, this function behaves l
  • hashCode
  • compare
    Compares two int values.
  • longValue
    Returns the value of this Integer as along.
  • numberOfLeadingZeros
    Determines the number of leading zeros in the specified integer prior to the #highestOneBit(int).
  • longValue,
  • numberOfLeadingZeros,
  • getInteger,
  • doubleValue,
  • toBinaryString,
  • byteValue,
  • bitCount,
  • shortValue,
  • highestOneBit

Popular in Java

  • Reactive rest calls using spring rest template
  • runOnUiThread (Activity)
  • onCreateOptionsMenu (Activity)
  • addToBackStack (FragmentTransaction)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now