if(intNumber==0)return 0; int mag; for(mag=7;mag>=0;mag--){ if((1<<mag)&(intNumber-1)){ break; } } mag++; return 128*mag+(1<<(8-mag))*intNumber;