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 :: Multiply two Strings Leetcode 
Java :: how to iterate hashset in java 8 
Java :: How to create a union-find data structure, in Java? 
Java :: java current time millis 
Java :: java word count 
Java :: How to create an adjacency list representation of a graph, in Java? 
Java :: convert local datetime to instant java 
Java :: android studio close app 
Java :: java regex ip 
Java :: Java Copying Arrays Using copyOfRange() method 
Java :: array to arraylist 
Java :: how to convert int array to integer list in java 
Java :: spring security enable global cors 
Java :: jave arrayList to Array 
Java :: mockito verify not called 
Java :: What is unreachable catch block error? 
Java :: loop through a 2d array java 
Java :: android studio textbox change text 
Java :: java suppress warnings rawtypes 
Java :: how to round up in java 
Java :: object to double java 
Java :: check if all values are same in list java 
Java :: sort list of strings java 
Java :: java reverse linked list 
Java :: pi in java 
Java :: what is java plug-in 
Java :: android localdatetime 
Java :: jbutton set on action 
Java :: hashmap iteration 
Java :: how to check the lines in a file java scanner 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =