求解:写一个程序做低于256位整数的运算 比如输入: 12,23 输出: 12 *23 ------ 36 24 ------ 276 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public static void main(String[] args) { Integer one = 12; Integer two = 23; System.out.println(one * getFirstIndex(two)); System.out.println(one * getLastIndex(two)); } public static Integer getFirstIndex(Integer i) { return i / 10; } public static Integer getLastIndex(Integer i) { return i % 10; }第二步,不知道你怎么算的。 import java.util.Scanner;public class Test05 { public static void main(String args[]) { String str; Scanner s = new Scanner(System.in); str = s.next(); System.out.println(str); String[] _str = str.split(","); int first = Integer.parseInt(_str[0]); int second = Integer.parseInt(_str[1]); System.out.println(first); System.out.println("*" + second); System.out.println("--------------"); int count = 0; for (int i = 0; i < _str[1].length(); i++) { char ch = _str[1].charAt(_str[1].length() - 1 - i); System.out.println(first * Integer.parseInt(ch + "")); if (i == 0) { count += (first * Integer.parseInt(ch + "")) ; } else { count += (first * Integer.parseInt(ch + "")) * (i) * 10; } } System.out.println("--------------") ; System.out.println(count) ; }}12,3212,3212*32--------------2436--------------384 jboss 1099端口不能远程访问 CSDN新手请教JDBC外网连接SQL问题 请大家解疑 java小程序—总共创建了多少个对象! 最终使用到了几个? 请教一个算法问题 请教string数组的排序问题! JBuilder2005与JBuilder2005哪个版本更新? 请问怎么使用剪贴板类阿? 新手提问:Exception in thread "main" java.lang.NoSuchMethodError: main是什么意思? jsp的基础入门的好书能推荐一本吗?^_^ java如何设置超时控制呢? 恳求请高手指点-关于heritrix netbeans 不能预览设计了。内详
{
Integer one = 12;
Integer two = 23;
System.out.println(one * getFirstIndex(two));
System.out.println(one * getLastIndex(two));
}
public static Integer getFirstIndex(Integer i)
{
return i / 10;
}
public static Integer getLastIndex(Integer i)
{
return i % 10;
}第二步,不知道你怎么算的。
import java.util.Scanner;public class Test05 { public static void main(String args[]) { String str;
Scanner s = new Scanner(System.in);
str = s.next();
System.out.println(str);
String[] _str = str.split(","); int first = Integer.parseInt(_str[0]);
int second = Integer.parseInt(_str[1]); System.out.println(first);
System.out.println("*" + second);
System.out.println("--------------");
int count = 0;
for (int i = 0; i < _str[1].length(); i++) {
char ch = _str[1].charAt(_str[1].length() - 1 - i); System.out.println(first * Integer.parseInt(ch + ""));
if (i == 0) {
count += (first * Integer.parseInt(ch + "")) ;
} else {
count += (first * Integer.parseInt(ch + "")) * (i) * 10;
}
}
System.out.println("--------------") ;
System.out.println(count) ; }
}12,32
12,32
12
*32
--------------
24
36
--------------
384