Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #3206
| From | "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: Need help to convert |
| Message-ID | <mlt2s39rl8j9c813n610felfcm0vs2qn13@4ax.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <cfbd828c-f3af-4995-bfa8-f38698468402@m23g2000hsc.googlegroups.com> |
| Date | 2011-04-27 15:43 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui On Sat, 23 Feb 2008 20:46:10 -0800 (PST), Katak <vampireex@hotmail.com> wrote, quoted or indirectly quoted someone who said : > double exponent = Math.pow(2, power); > result += ((bin.charAt(i) - 48) * (exponent)); > power++; Shift would be more accurate and much much faster. power = 1; ... power <<= 1; or even better just shift (bin.charAt(i) - '0') directly by i. see http://mindprod.com/jgloss/shift.html http://mindprod.com/jgloss/binary.html http://mindprod.com/jgloss/precedence.html http://mindprod.com/jgloss/bit.html http://mindprod.com/jgloss/masking.html -- Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Need help to convert "Katak" <katak@THRWHITE.remove-dii-this> - 2011-04-27 15:43 +0000
Re: Need help to convert "Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this> - 2011-04-27 15:43 +0000
Re: Need help to convert "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:43 +0000
Re: Need help to convert "Katak" <katak@THRWHITE.remove-dii-this> - 2011-04-27 15:43 +0000
Re: Need help to convert "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:43 +0000
Re: Need help to convert "Katak" <katak@THRWHITE.remove-dii-this> - 2011-04-27 15:43 +0000
Re: Need help to convert "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:43 +0000
Re: Need help to convert "tar" <tar@THRWHITE.remove-dii-this> - 2011-04-27 15:43 +0000
Re: Need help to convert "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:43 +0000
csiph-web