what is time complexity of concatenating two int in java example
2014-01-03 13:55
525 查看
int a=18965;
int b=78521369741;
after concatenation i want ans in primitive integer data types like,
int c=1896578521369741;
i want to know what is the fastest way to do this and what will be the time complexity ?
int b=78521369741;
after concatenation i want ans in primitive integer data types like,
int c=1896578521369741;
i want to know what is the fastest way to do this and what will be the time complexity ?
private static void concat(long a, long b) { long temp = b; while (temp > 0) { temp /= 10; a *= 10; } a += b; System.out.println(a); }
相关文章推荐
- What is the ARGB int encoding of pixels in Java's AWT?
- Class JavaLaunchHelper is implemented in both. One of the two will be used. Which one is undefined
- Time complexity of ArrayList in Java
- Class JavaLaunchHelper is implemented in both … libinstrument.dylib. One of the two will be used. Wh
- Class JavaLaunchHelper is implemented in both … libinstrument.dylib. One of the two will be used. Wh
- What is meaning of run level in Linux system? What are they?
- Java中long类型直接赋值出现The literal xxxxxxxxxx of type int is out of range 问题的原因和解决方法
- Java - What is final in Java?
- What is DB time in AWR?
- Example of Unix commands implemented in Java
- What is the role of the activation function in a neural network?
- Is the Improvement of String.substring() in Java7 Really Reasonable?
- java.lang.RuntimeException: Date pattern must be set for column update_time in the schema of component
- what is the difference of select single and select up to one row in abap
- What does "size" in int(size) of MySQL mean?
- Question 38: What is the output of the program below in C++?
- How Synchronization works in Java ? Example of synchronized Block and Method
- What is DB time in AWR?
- What means the error-message 'java.lang.OutOfMemoryError: GC overhead limit exceeded' in Java?
- What exactly is null in Java?[转]