Hi i'm trying to convert long value into String but getting error
Type mismatch: cannot convert from long to String
This is the block of code please have a look
URLConnection localURLConnection = new URL("http://hugosys.in/SQLite/sk2.db").openConnection();
int i = localURLConnection.getContentLength();
BufferedInputStream localBufferedInputStream = new BufferedInputStream(localURLConnection.getInputStream());
ByteArrayBuffer localByteArrayBuffer = new ByteArrayBuffer(1024);
FileOutputStream localFileOutputStream = new FileOutputStream(Download_Db.this.dbFile);
long l = 0L;
for (;;)
{
int j = localBufferedInputStream.read();
if (j == -1)
{
localFileOutputStream.flush();
localFileOutputStream.close();
return;
}
l += j;
localByteArrayBuffer.append((byte)j);
if (localByteArrayBuffer.length() > 2000)
{
byte[] arrayOfByte = localByteArrayBuffer.toByteArray();
localByteArrayBuffer.clear();
String[] arrayOfString = new String[1];
arrayOfString[0] = (l / i);
publishProgress(arrayOfString);
localFileOutputStream.write(arrayOfByte);
}
}
return;
Learn how to use the Java API
long longValue = 42l;
String stringValue = String.valueOf(longValue);
(http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html#valueOf(long))