求解:写一个程序做低于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 求SCJP的的中、英文教程 不胜感激 java 多线程 请教 望点化 怎么部署java工程?桌面级的 麻烦大虾帮忙写个实现jscrollpane和jtextarea常用功能的代码 能帮小女子解决一下java数据库问题? 趁大家还没有睡觉 帮我看看 jsp中如何引用其他文件中的变量(包括三维数组)? 简单程序改错(I/O)~~`~刚来的没分了,昨天全撒水园了 我如何用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