char[] 配列に整数データがあります。例: 12, 03, 10. データを 16 進形式の文字列で送信したい。
例:0C030A
しかし、16 進数に変換した後、C3A を取得しています。
0C030Aとして正しいデータを取得することをお勧めします。
次のコードを使用しています
String messageBody = "A3";
SimpleDateFormat sdf = new SimpleDateFormat("MM:dd:yy:HH:mm:ss");
String currentDateandTime = sdf.format(new Date(mLocation.getTime()));
char[] temp;
temp = currentDateandTime.split(delimiter);
for( int i = 0; i < temp.length; i++ )
{
messageBody += Integer.toHexString (Integer.parseInt( temp[i]));
}