Monday, 15 February 2010

android - Conversion of Variable Value from String to Long in Java -



android - Conversion of Variable Value from String to Long in Java -

is there anyway of converting value of string long in java? apparently, string.format("%040x", new biginteger(1, message.getbytes(message))); changes format of instead of value. need alter value using converted variable encryption (prince) process processed in long (hexadecimal) format.

public void onclick(view v, string args) { string phoneno = txtphoneno.gettext().tostring(); string message = txtmessage.gettext().tostring(); if (phoneno.length()>0 && message.length()>0){ //prince pri = new prince(); //message = tolong(); string.format("%040x", new biginteger(1, message.getbytes(message))); prince.encrypt (message, k0, kop, k1, t); sendsms(phoneno, message); } else toast.maketext(getbasecontext(), "please come in both phone number , message.", toast.length_short).show(); }

you can utilize long.parselong() that.

new biginteger(1, message.getbytes(message)) shouldn't work. first of all, message.getbytes() throws exception unknown charsets.

also, new biginteger(1, message.getbytes("utf-8")) homecoming odd results input.

my guess question is: how can convert string bytes , hex string?

solution:

byte[] info = message.getbytes("utf-8");

to byte array string. question tells how can convert hex string: convert byte array hex string in java

java android string cryptography data-type-conversion

No comments:

Post a Comment