View Full Version : binary to decimal / Palindromes
lse123
10-07-2008, 12:29 AM
I am reading JAVA:How to program 7th /E , 4th chapter finished just now,
by the way can you tell me some lines of source, work , if i have a binary number (eg 1110001101) use "%" & "/" to make it decimal(ex.4.31 p.184) by picking off binary numbers one at a time ?
Palindromes: Also any function in java make a number it's inverse number, eg 12345 make it 54321 ?
java mob: pdas with large LCD programmed mainly in XHTML Basic ? Or can display and normal XHTML (with scrolls) ?
lse123
10-07-2008, 12:31 AM
If I have two PCs is needed register Netbeans 6.1 IDE twice ?
lse123
10-07-2008, 06:20 AM
PLEASE ANSWER: And questions prior, at start...
Fou-Lu
10-08-2008, 05:46 AM
The binary conversion can be done using the Integer wrapper class:
try
{
int converted = Integer.parseInt("1110001101", 2);
}
catch (NumberFormatException ex)
{
}
If you mean to make it a float, I think that the double class wrapper also takes a radix. To do this manually, I'd simply loop through it for decString.length in decrementing fashion, and use leftshifting with addition to track the amount. You can also bitmask it. There are a lot of solutions.
As for reversing, I think you're out of luck on that one. I don't *think* that the String.getChars works in reverse where you give it a starting position of the length - 1, and an ending position of 0. The easiest way would be to convert it to a char array with the string wrapper, and then iterate through it backwards, and finally converting the resulting string back into an integer. Man a char * would really help here...
I have no idea about the PDA though. I've only done the small handheld devices, so I have no idea what a PDA requires.
If you plan on installing netbeans on 2 computers, you'll need to register it twice. Not really a problem though, netbeans is free anyway. Otherwise, just remote into the computer with it installed and work from there.
lse123
10-10-2008, 11:17 AM
in wmlscript how to build my own libraries ? After build , i refer functions as
myLib.myfunction() or
myLib#myfunction() ?
lse123
10-10-2008, 11:23 AM
VS2008express is 64bit software ? There's version for mac apple pc ?
Fou-Lu
10-11-2008, 07:23 AM
Libraries will be . referenced. Visual Studio can likely be found in a 32 bit build, but good luck finding a copy for mac.
This is unrelated to Java though, sounds like you're programming in C#.
lse123
10-11-2008, 07:47 AM
How I build my own libraries in java ? how then I refer a functionX() in LibraryX ?
Fou-Lu
10-12-2008, 04:41 AM
Packages are what java usually uses. All you need to do is jar the file and provide an external reference to it. Import it in using the import keyword, and access it properties through period referencing: namespace.class.method.
lse123
10-12-2008, 11:04 AM
How I build my own libraries of classes/methods in java ? how then I refer a functionX() (i mean method) in LibraryX ? can you give a short/brief example of a library with a class with a method and a main method of normal class calling this method (of external's added library's) ?
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.