我在ubuntu 11.10上安装了带有Eclipse android插件(ADT)的Eclipse 4.2.当我作为Android应用程序启动"Hello World"项目时,它根本就不会启动!
ps -x>启动模拟器后的log.txt,输出:
1000 7221 20.0 0.6 16884 6908 ? D 18:11 0:00 /home/tutakhail/android-sdks/tools/emulator-arm -avd AndroidBrowser -netspeed full -netdelay none
Run Code Online (Sandbox Code Playgroud)
从shell手动启动模拟器,我得到以下错误,不久之后模拟器启动但非常慢.
emulator: ERROR: Could not load OpenGLES emulation library: libOpenglRender.so: cannot open shared object file: No such file or directory
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
Run Code Online (Sandbox Code Playgroud)
关于什么可能是问题的任何提示?也许与Ubuntu有关?
Java的8有许多可选类,像OptionalDouble,OptionalInt,OptionalLong.
是否有一种很好的操作方式与相同类型的可选值?也就是说,我希望能够做到:
OptionalDouble d1 = OptionalDouble.of(1.);
OptionalDouble d2 = OptionalDouble.of(2.);
OptionalDouble d3 = OptionalDouble.of(3.);
OptionalDouble result = d1.add(d2).multiply(d3);
Run Code Online (Sandbox Code Playgroud)
当然,如果它们中的任何一个"空",结果应该是空的.在谷歌搜索了一下后,我发现了一些代码示例,人们正在使用这些函数(例如add),但它不是API的一部分(不再是?).
给定数字N,找到最小的偶数E,使得E> N且N和E中的数字相同。
Print NONE otherwise.
Sample:
Case1
Input
N = 34722641
Output
E = 34724126
Case2
Input
N = 8234961
Output
E = 8236194 (instead of 8236149)
Run Code Online (Sandbox Code Playgroud)
我的第二种情况通过了第一种情况,我的输出错误
public static int nextDigit(int number) {
String num = String.valueOf(number);
int stop = 0;
char[] orig_chars = null;
char[] part1 = null;
char[] part2 = null;
orig_chars = num.toCharArray();
for (int i = orig_chars.length - 1; i > 0; i--) {
String previous = orig_chars[i - 1] + "";
String next = …Run Code Online (Sandbox Code Playgroud) 这是我的计划
// ************************************************************
// PowersOf2.java
//
// Print out as many powers of 2 as the user requests
//
// ************************************************************
import java.util.Scanner;
public class PowersOf2 {
public static void main(String[] args)
{
int numPowersOf2; //How many powers of 2 to compute
int nextPowerOf2 = 1; //Current power of 2
int exponent= 1;
double x;
//Exponent for current power of 2 -- this
//also serves as a counter for the loop Scanner
Scanner scan = new Scanner(System.in);
System.out.println("How many powers …Run Code Online (Sandbox Code Playgroud) 我对JDBC的rs.getString("column_name")有一些问题,基本上它不会分配从查询结果中收到的值,我有一个String ris,它应该从rs.getString获取行名,这是为了简单的问题我正在使用ris,我的查询只返回一行.这是代码:
//It returns null, or any other values I use to initialize the variable
String ris=null;
q = "SELECT DISTINCT nome FROM malattia WHERE eta='" + age + "' AND sesso='" + sexstr + "' AND etnia='" + etniastr + "' AND sintomi IN(" + tes + ")";
ResultSet rs = st.executeQuery(q);
if (!rs.last()) {
ris = "no";
}
else {
//This is the place where I'm having problems
while(rs.next()){
//ris is supposed to get the …Run Code Online (Sandbox Code Playgroud) 我面临以下问题:
与临时值相比,我将获得类似或更长的值:
public class NumberFormat {
public static void main(String arg[]){
Integer numValue = null;
String temp="5474151538110135";
numValue=Integer
.parseInt(temp.trim());
System.out.println("--> "+numValue);
}
}
Run Code Online (Sandbox Code Playgroud)
请提供解决方案.
Exception in thread "main" java.lang.NumberFormatException: For input string: "5474151538110135"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:60)
at java.lang.Integer.parseInt(Integer.java:473)
at java.lang.Integer.parseInt(Integer.java:511)
at com.filetransfer.August.NumberFormat.main(NumberFormat.java:10)
Run Code Online (Sandbox Code Playgroud)