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

How to use
parseInt
method
in
java.lang.Integer

Best Java code snippets using java.lang.Integer.parseInt (Showing top 20 results out of 171,180)

origin: google/guava

private static short parseHextet(String ipPart) {
 // Note: we already verified that this string contains only hex digits.
 int hextet = Integer.parseInt(ipPart, 16);
 if (hextet > 0xffff) {
  throw new NumberFormatException();
 }
 return (short) hextet;
}
origin: google/guava

private static byte parseOctet(String ipPart) {
 // Note: we already verified that this string contains only hex digits.
 int octet = Integer.parseInt(ipPart);
 // Disallow leading zeroes, because no clear standard exists on
 // whether these should be interpreted as decimal or octal.
 if (octet > 255 || (ipPart.startsWith("0") && ipPart.length() > 1)) {
  throw new NumberFormatException();
 }
 return (byte) octet;
}
origin: square/okhttp

 private static int parsePort(String input, int pos, int limit) {
  try {
   // Canonicalize the port string to skip '\n' etc.
   String portString = canonicalize(input, pos, limit, "", false, false, false, true, null);
   int i = Integer.parseInt(portString);
   if (i > 0 && i <= 65535) return i;
   return -1;
  } catch (NumberFormatException e) {
   return -1; // Invalid port.
  }
 }
}
origin: google/guava

 @Override
 public void parse(CacheBuilderSpec spec, String key, String value) {
  checkArgument(value != null && !value.isEmpty(), "value of key %s omitted", key);
  try {
   parseInteger(spec, Integer.parseInt(value));
  } catch (NumberFormatException e) {
   throw new IllegalArgumentException(
     format("key %s value set to %s, must be integer", key, value), e);
  }
 }
}
origin: google/guava

 @Override
 public Integer apply(String input) {
  return Integer.parseInt(input);
 }
};
origin: spring-projects/spring-framework

  @Override
  public Integer convert(String source) {
    return Integer.parseInt(source);
  }
}
origin: ReactiveX/RxJava

@Override
public void onNext(String v) {
  int num = Integer.parseInt(v);
  System.out.println(num);
  // doSomething(num);
  count.incrementAndGet();
}
origin: ReactiveX/RxJava

@Override
public void onNext(String v) {
  int num = Integer.parseInt(v);
  System.out.println(num);
  // doSomething(num);
  count.incrementAndGet();
}
origin: ReactiveX/RxJava

@Override
public void onNext(String v) {
  int num = Integer.parseInt(v);
  System.out.println(num);
  // doSomething(num);
  count.incrementAndGet();
}
origin: ReactiveX/RxJava

@Override
public void onNext(String v) {
  int num = Integer.parseInt(v);
  System.out.println(num);
  // doSomething(num);
  count.incrementAndGet();
}
origin: ReactiveX/RxJava

@Override
public void onNext(String v) {
  int num = Integer.parseInt(v);
  System.out.println(num);
  // doSomething(num);
  count.incrementAndGet();
}
origin: ReactiveX/RxJava

@Override
public void onNext(String v) {
  int num = Integer.parseInt(v);
  System.out.println(num);
  // doSomething(num);
  count.incrementAndGet();
}
origin: google/guava

 @Override
 public Integer load(String key) {
  wasCalled = true;
  return valuePrefix + Integer.parseInt(key.substring(keyPrefix.length()));
 }
}
origin: spring-projects/spring-framework

private void adaptForwardedHost(String hostToUse) {
  int portSeparatorIdx = hostToUse.lastIndexOf(':');
  if (portSeparatorIdx > hostToUse.lastIndexOf(']')) {
    host(hostToUse.substring(0, portSeparatorIdx));
    port(Integer.parseInt(hostToUse.substring(portSeparatorIdx + 1)));
  }
  else {
    host(hostToUse);
    port(null);
  }
}
origin: google/guava

/**
 * Computes the mean in a way that is obvious and resilient to overflow by using BigInteger
 * arithmetic.
 */
private static int computeMeanSafely(int x, int y) {
 BigInteger bigX = BigInteger.valueOf(x);
 BigInteger bigY = BigInteger.valueOf(y);
 BigDecimal bigMean =
   new BigDecimal(bigX.add(bigY)).divide(BigDecimal.valueOf(2), BigDecimal.ROUND_FLOOR);
 // parseInt blows up on overflow as opposed to intValue() which does not.
 return Integer.parseInt(bigMean.toString());
}
origin: spring-projects/spring-framework

  @Override
  public void setAsText(String text) {
    setValue(new Integer(Integer.parseInt(text) + 1));
  }
});
origin: spring-projects/spring-framework

private int nextReferredCharacterId() throws IOException {
  String reference = nextWordToken();
  if (reference != null && reference.startsWith("&#") && reference.endsWith(";")) {
    return Integer.parseInt(reference.substring(2, reference.length() - 1));
  }
  return -1;
}
origin: spring-projects/spring-framework

  @Override
  public TestBean parse(String text, Locale locale) throws ParseException {
    TestBean object = new TestBean();
    object.setSpecialInt(Integer.parseInt(text));
    return object;
  }
}
origin: spring-projects/spring-framework

  @Override
  public void setAsText(String text) {
    TestBean tb = new TestBean();
    StringTokenizer st = new StringTokenizer(text, "_");
    tb.setName(st.nextToken());
    tb.setAge(Integer.parseInt(st.nextToken()));
    setValue(tb);
  }
}
origin: spring-projects/spring-framework

  @Override
  public void setAsText(String text) {
    TestBean tb = new TestBean();
    StringTokenizer st = new StringTokenizer(text, "_");
    tb.setName(st.nextToken());
    tb.setAge(Integer.parseInt(st.nextToken()));
    setValue(tb);
  }
}
java.langIntegerparseInt

Javadoc

Parses the specified string as a signed decimal integer value. The ASCII character \u002d ('-') is recognized as the minus sign.

Popular methods of Integer

  • 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.
  • decode
    Parses the specified string and returns a Integer instance if the string can be decoded into an inte
  • numberOfLeadingZeros
    Determines the number of leading zeros in the specified integer prior to the #highestOneBit(int).
  • decode,
  • numberOfLeadingZeros,
  • getInteger,
  • doubleValue,
  • toBinaryString,
  • byteValue,
  • bitCount,
  • shortValue,
  • highestOneBit

Popular in Java

  • Updating database using SQL prepared statement
  • startActivity (Activity)
  • putExtra (Intent)
  • compareTo (BigDecimal)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Top plugins for WebStorm
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