Java - ASCII2Bin - First Draft |
||
![]() Ker Socrat Ok, i managed to find how to change a character to its binary form with this code. The problem is , when i entered a normal character ( a or b or ^*&*( ;' ) its fine, it give the exact same result as the php SNEAK. but then i tryed with some ASCII like °╞╧◘↔¼èá4↕ÿ and that messed up because on the php SNEAK version, the characters are converted back to #6365 or whatever their value is before they are converted to binary. But with this code they get converted for their real binary value, which is not what we want since they can be 15 chars long (1100101011110). So anyone knows how to modify it to check if its a "special" char and if it is convert to the #5646 value? public static String string2Bin(String str){
String binaryString = new String();
for(int i=0;i<str.length();i++){
int decimal = str.charAt(i);
String binary = Integer.toBinaryString(decimal);
binaryString += " 0"+binary;
}
return binaryString;
}
Kernel Socrat
X/O CAUniversity CAUniversity.org Administrator Cyberarmy Staff Member CAUniversity.org Replies:
|
||
| CyberArmy::Forum v0.6 Generated In 0.02296 seconds |