//String转double
String x = "154.5";
String y = "123.4";
double dx = Double.parseDouble(x);
double dy = Double.parseDouble(y);//String转换为double//String转int
String x = "15";String y = "12";int dx = Integer.parseInt(x);int dy = Integer.valueOf(y).intValue(); //String转换为intLog.i(TAG , ""+ dx+ dy);//double到Long
Long lUpdateMilis = updateMilis.longValue();//double转long//inputStream转换成String(此方法效率高些)public static String inputStreamToString(InputStream in) throws IOException {StringBuffer out = new StringBuffer();byte[] b = new byte[4096];for (int n; (n = in.read(b)) != -1;) {out.append(new String(b, 0, n));}return out.toString();} //inputStream转换成Stringpublic static String inputStream2String(InputStream is) throws IOException {ByteArrayOutputStream baos = new ByteArrayOutputStream();int i = -1;while ((i = is.read()) != -1) {baos.write(i);}return baos.toString();}
long时间戳 转时间
public static String getTime(int mss) { int hours = (mss / (1000 * 60 * 60)); int minutes = (mss - hours * (1000 * 60 * 60)) / (1000 * 60); int seconds = (mss - hours * (1000 * 60 * 60) - minutes * (1000 * 60)) / 1000; return hours + " hours " + minutes + " minutes " + seconds + " seconds "; }