Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java string to long

public class Example {
   public static void main(String[] args)
   {
       String str = "11111";
       String str2 = "88888";
       //Conversion using valueOf(String) method
       long num = Long.valueOf(str);
       long num2 = Long.valueOf(str2);
       System.out.println(num+num2);		
   }
}
Output:
99999
Comment

string to long java

 Long.parseLong("0", 10)        // returns 0L
 Long.parseLong("473", 10)      // returns 473L
 Long.parseLong("-0", 10)       // returns 0L
 Long.parseLong("-FF", 16)      // returns -255L
 Long.parseLong("1100110", 2)   // returns 102L
 Long.parseLong("99", 8)        // throws a NumberFormatException
 Long.parseLong("Hazelnut", 10) // throws a NumberFormatException
 Long.parseLong("Hazelnut", 36) // returns 1356099454469L
 Long.parseLong("999")          // returns 999L
Comment

java string to long

public class Example {
   public static void main(String[] args)
   {
       String str = "10000";
       String str2 = "22222";
       //Conversion using Long(String s) constructor
       long num = new Long(str);
       long num2 = new Long(str2);
       System.out.println(num*num2);		
   }
}
Output:
222220000
Comment

java covert string to long



       String str = "11111";
       String str2 = "88888";
       //Conversion using valueOf(String) method
       long num = Long.valueOf(str);
       long num2 = Long.valueOf(str2);
       System.out.println(num+num2);	// print 99999	
Comment

PREVIOUS NEXT
Code Example
Java :: How do you print duplicate characters from a string? 
Java :: collision java 
Java :: bukkit runnable repeating scheduler 
Java :: how to vibrate android java 
Java :: android studio visibility 
Java :: java fps 
Java :: how to take space separated input in java 
Java :: arraylist with values java 
Java :: take string array input in java 
Java :: how to randomize an array java 
Java :: remove autofocus edittext android 
Java :: sleep for milliseconds in java 
Java :: how to remove character from stringbuilder in java 
Java :: how to remove java from ubuntu 
Java :: java contains password input 
Java :: java ldaps certificate self signed 
Java :: difference between premitive and non-premitive 
Java :: java string to char array 
Java :: how to convert a hexadecimal number to a decimal inside a println in java 
Java :: java get domain from url 
Java :: target element in a sorted matrix of distinct ints 
Java :: count the number of words in a string java 
Java :: change color of text in textview android 
Java :: java remove from arraylist while iterating 
Java :: how to find smallest number in array java 
Java :: java swing array of buttons 
Java :: java compare two lists ignore case 
Java :: localdate to date java 
Java :: infinity constatn in java 
Java :: android studio get string from strings.xml 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =