Bonjour,
le code suivant me retourne un truc bizarre , un null devant, pourquoi ? alors que je veux afficher le contenu d'un tableau de byte en hexa.
Merci de votre aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 public void readbuffer() { byte [] tab = {'A','B','C','D','E','F'}; String Str = null; String s = null; Str = new String(tab); for (int i = 0; i < Str.length(); i++) { char c = Str.charAt(i); s = s + String.format("%02x",(int) c); } System.out.printf("%s\n", s); } Resultat: null414243444546 ???
Partager