Bonsoir
quand je transforme un float (Format 0.XXXX) en binaire j'utilise les fonctions suivantes et ça fonctionneaprès quelques transformations j'obtiens un tableau de 1 et 0 et je veux le convertir en float.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 int tab=new int[30]; float ko=ty[k]; //je récupère le float. int p= Float.floatToIntBits(ko); String s=Integer.toBinaryString(p); char[]resu=s.toCharArray(); for(int j=0;j<30;j++) //je le met dans un tableau pour y faire //quelque transformation(+,-..etc) { if(ko==0.0) tab[j]=0; else tab[j]=(int)resu[j]-48;
Je le convertit d'abord en String puis le string au float mais ERREUR:
j'ai essayé de convertir le string en int puis en float mais la même erreur?? d'après ce que j'ai compris mon string ne peut pas être convertit en entier
000Exception in thread "main" java.lang.NumberFormatException: For input string: "[I@3e25a5"
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at java.lang.Float.parseFloat(Unknown Source)
Alors si vous avez une idée sur comment procéder pour que lese convertisse en float merci beaucoup de m'aider111100100100100011011100100001![]()
Partager