Hex to binary and vice versa is some of the easiest - I like that converting much more than decimal to something - I mean base 10 dosen't mix good with base 16
It's too bad the Arabs/Romans/Greek/whoever who set up the predominant base 10 system didn't plan ahead. Would have been much better if we'd gone for base 2, 8 or 16 instead.
The direct use of force is such a poor solution to any problem, it is generally employed only by small children and large nations David Friedman
It's too bad the Arabs/Romans/Greek/whoever who set up the predominant base 10 system didn't plan ahead. Would have been much better if we'd gone for base 2, 8 or 16 instead.
Im having this plan for CEs children....
While others climb the mountains High, beneath the tree I love to lie
And watch the snails go whizzing by, It's foolish but it's fun
Originally posted by Dottie
Im having this plan for CEs children....
It's going to be rough for us "oldtimers" when the next generation of geeks start taking charge. I'm hoping there will be a few years yet before I start falling behind
I don't see much hope in changing the numerical system... just look how long it has taken to get the metric system implemented - and in the US they still teach the imperial system until you get to the university level.
The direct use of force is such a poor solution to any problem, it is generally employed only by small children and large nations David Friedman
Here, grab mine. It's C and outputs in hex, but from hex to binary is good brain excercise
<snip>
Thanks - but no need - Java is fast
public class Convert
{
public String setString(String textIn)
{
String temp = "";
for (int i = 0; i < textIn.length(); i++)
{ temp += this.convertToBinary(""+(int) textIn.charAt(i)); }
while (decimal != 0)
{
temp.append(decimal % 2);
decimal = decimal/2;
}//end while
if (temp.length() < 8)
{
for (int i = temp.length(); i < 8; i++)
{ temp.append("0"); } //end for
}//end if
return temp.reverse().toString();
}//end method
}//end class
A bit fast-made and uneffecient code - but still - think it works
Actually, I just don't feel like digging out my old HEx and Binary notes to talk back...
your just jealous.
Leet people can program their own leet program.
actually I should program a leet (text-book leet) java program - would be quite easy ............ naaa - sticking with binary - maybe making it octal for the good ole days