<html>
<body>
<pre>
Hi Adeeshwar !
I try to throw some light to this code.
The Operator precedence is the only thing to look at:
Operators listed from highest precedence to lowest:
</pre>
Group | Operators |
postfix operators | <code>[] . (params) expr++ expr--</code> |
unary operators | <code>++expr --expr +expr -expr ~ !</code> |
creation or cast | <code>new (type)expr</code> |
multiplicative | <code>* / %</code> |
additive | <code>+ -</code> |
shift | <code><< >> >>></code> |
relational | <code>< > >= <= instanceof</code> <tr><td>equality <td><code>== !=</code> <tr><td>bitwise AND <td><code>&</code> <tr><td>bitwise exclusive XOR <td><code>^</code> <tr><td>bitwise inclusive OR <td><code>|</code> <tr><td>logical AND <td><code>&&</code> <tr><td>logical OR <td><code>| |</code> <tr><td>conditional <td><code>?:</code> <tr><td>assignment <td><code>= += -= *= /= %= >>= <<= >>>= &= ^= |=</code> |
<pre>
public class Have{
private Have(){
int x=1702845791; //Decimal = 0xcafebabe/2
int y=014537656537; //Octal = 0xcafebabe/2
int a=0x657f5d5e; //Hex = 0xcafebabe/2 -1
int b=014537656540; //Octal 0xcafebabe/2 +1
/*
System.out.println(this.getClass().getName()+" "+Integer.
toHexString(x--<<(y-->>>(a++/x*x++^--a))/(b++>>>(y--/--a))).
toUpperCase());
*/
//(x--<<(y-->>>(a++/x*x++^--a))/(b++>>>(y--/--a)))
//Splitting this Monster to smaller pieces in this order:
x--; //From left to right
y--;
int par1=(a++/x*x++^--a);//First parenthes to count
int par2=(y>>>par1); //Unsigned shift
b++;
int par3=(y--/--a);
int par4=(b>>>par3);
int par5=(par2/par4);//Integer division= 1
int par6=(x<<par5); >
//Overflow OOps !!
??
//I didn't ment that way
x<<1 = x*2
System.out.println(this.getClass().getName()+" "+Integer.
toHexString(par6).toUpperCase());
}
public static void main(String[]_){
new Have();
}
}
I hope this helps
</pre></body></html>
[This message has been edited by Jorma Koistinen (edited December 01, 2000).]
[This message has been edited by Jorma Koistinen (edited December 01, 2000).]
[This message has been edited by Jorma Koistinen (edited December 01, 2000).]