About 172,000 results
Open links in new tab
  1. Java - Convert integer to string - Stack Overflow

    Integer class has static method toString () - you can use it: int i = 1234; String str = Integer.toString(i); Returns a String object representing the specified integer. The argument is …

  2. How do I convert a String to an int in Java? - Stack Overflow

    790 For example, here are two ways: Integer x = Integer.valueOf(str); // or int y = Integer.parseInt(str); There is a slight difference between these methods: valueOf returns a …

  3. java - How do I convert from int to String? - Stack Overflow

    Nov 5, 2010 · If you say ""+i, Java creates a StringBuilder object, appends an empty string to it, converts the integer to a string, appends this to the StringBuilder, then converts the …

  4. A Java collection of value pairs? (tuples?) - Stack Overflow

    456 I like how Java has a Map where you can define the types of each entry in the map, for example <String, Integer>. What I'm looking for is a type of collection where each element in …

  5. Converting an int to a binary string representation in Java?

    Mar 9, 2010 · 46 There is also the java.lang.Integer.toString (int i, int base) method, which would be more appropriate if your code might one day handle bases other than 2 (binary). Keep in …

  6. java - Integer to String conversion methods - Stack Overflow

    Sep 27, 2010 · What are the alternative methods for converting and integer to a string?

  7. Most efficient way of converting String to Integer in java

    Jun 25, 2009 · There are many ways of converting a String to an Integer object. Which is the most efficient among the below: Integer.valueOf() Integer.parseInt() …

  8. java - Using streams to convert a list of objects into a string ...

    String s = list.stream().map(e -> e.toString()).reduce("", String::concat); Explanation: map converts Integer stream to String stream, then its reduced as concatenation of all the elements. Note: …

  9. What's the best way to check if a String represents an integer in …

    May 7, 2015 · If you are concerned whether you can actually parse the string into an int or long you would also need to check if the integer the string represents actually fits into those data …

  10. java - compare two numeric String values - Stack Overflow

    Java Caches the Integer objects in a certain range, which is generally [-128, 127], in which case, it will not create a new Integer object when you assign an integer literal to an Integer reference, …