您的位置:首页 > 编程语言 > Java开发

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 ?
private static void concat(long a, long b) {

long temp = b;
while (temp > 0) {
temp /= 10;
a *= 10;
}
a += b;
System.out.println(a);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: