int decVal = 26; // The number 26, in decimal
int octVal = 032; // The number 26, in octal
int hexVal = 0x1a; // The number 26, in hexadecimal
like is there any speed advantage in what you choose?
Name:
Anonymous2009-02-06 6:27
lol
Name:
Anonymous2009-02-06 6:30
26::Dec
32::Oct
1A::Hex
26.0::Float
Name:
Anonymous2009-02-06 7:02
lol
Name:
Anonymous2009-02-06 8:38
>>1
Computars think in binary, so the fastest would be int binVal = 0b11010, however translation from hex is pretty straightforward too, octal would be somewhat slower and the slowest by far would be decimal, except if your compiler supports pragma for BCD operations.
So you'd better use hex, as all true hackers (in the original meaning) do!
Name:
Anonymous2009-02-06 8:43
Octal is fastest because it is closest to the 8bit-in-a-byte pattern.
Name:
Anonymous2009-02-06 8:46
Decimal is the fastest for short numbers, while hexadecimal is faster for longer numbers.
Name:
Anonymous2009-02-06 9:05
If you compile it to bytecode it all becomes the same, no?
>>16
Only if you think in decimal. What kind of crappy Java programmer are you?
Name:
Anonymous2009-02-06 21:31
i hate octals
Name:
Anonymous2009-02-06 21:41
All of these are shitty amateur hacks, and nothing more. Real Java Programmers use an AbstractConstantsFactoryFactorySingleton, an associated XML loader, and retrieve their constants from a dynamically generated file on their Enterprise Edition Constants Server which allows increased flexibility of the code and easy redeployment on any system throughout the world while keeping a realtime-equivalent performance and maximizing their productivity through their object-oriented frameworks.
>cat anus.java
public class anus
{
public static void main(String args[])
{
int decVal = 26;
int octVal = 032;
int hexVal = 0x1a;
}
}
>javap -c anus
Compiled from "anus.java"
public class anus extends java.lang.Object{
public anus();
Code:
0: aload_0
1: invokespecial #1; //Method java/lang/Object."<init>":()V
4: return