Peter could you please explain the following : int i =-31; How will you convert the -31 to binary and back again to decimal. Please do me a favor. I am just CONFUSED with negative values. One more interesting topic double a,b; Thanx..... a = 2.0; b = 0.0; double c = a/b; Now when I do the following why it gives different results. int x = (int) c; and byte y = (byte) c; Waiting for reply.
Peter thanks for all your co-operation and help actually I have been working on bitwise topic since few days. Actually to some extent I am clear with few operators but when it comes to negative values, I get confused. Also explain how to judge a negative value when it is written in binary form. My main problem is with NEGATIVE VALUES AND SHIFTS. Mainly negative shifts. Guide me pleazzzzz. Just see to the following program and explain the output b'coz it gives a vast difference when it is 5 and -5 class RightShift { public static void main(String[] args) { int i =-5; //int i = 5; i >>= 1;
Thanx Peter but still doubts : --------------------------------------------------------------- 0101 >> 1 = 0010 = 2 = 5/2 0010 << 1 = 0100 = 4 = 2*2<br /> What does 5/2 and 2*2 suggests ??? - Explain pleazeee ...<br /> A N D..... the one below : <br /> 1011 >> 1 = 1101 = -3 = (-5)/2 (always rounding down, and a "1" is shifted into the left to preserve sign) 1011 >>>1 = 0101 = 5 (the unsigned bitshift operator always shifts in "0" and does not preserve sign) 0101 << 1 = 1010 = -6 (the left shift operator overflows in this case - there is no signed 4-bit representation of 5*2=10)<br /> I AM CONFUSED WITH THE NEGATIVE SHIFTS <br /> i.e <br /> 1011 >> 1 is how come -3 .... 1011 >>> 1 is how come 5 .... DO ME A FAVOR AND CLEAR MY DOUBTS THANX AGAIN.
Could anyone please explain me the following : How come the output of ~3 is -4 Could you give me a brief explaination regarding the same. And few hints related to Left/Right Shift,etc I am preparing for SCJP and in ref. books I am not having enough of explaination. Thanking you in ANTICIPATION. Regards Tejas
Hello friends I am working on JSP and I am using JAVAWEBSERVER2.0 Kindly guide me where to store (BEAN) .class files and where to store our JSP files b'coz when I am storing .jsp files in c:\javawebserver2.0\examples\jsp folder and the (Bean) .class file in c:\javawebserver2.0\classes folder along with the package I am getting an error "object or class not found ...." Could anyone guide me as soon as possible. Thanx in advance. Regards Tejas
I apologise for the prev. answer. Actually, I went thru the question again and corrected the answer and it is break middle or continue outer Hope I am right this time. Regards Tejas
Hello friends, Well, I am fresh with JSP. I would like to know where to store .jsp files, .class(bean files), etc if I am using JavaWebServer2.0 Can anyone make it clear for me. Thanx in adv. Regards Tejas
Well, friends got the idea but just wanted to know that whether there is any utility in java itself using which we can create executable files. Write back soon. Regards Tejas