/Users/lyon/j4p/src/bookExamples/appJBitOps/NegateOperations.java

1    package bookExamples.appJBitOps; 
2     
3    /** 
4     * DocJava, Inc. 
5     * http://www.docjava.com 
6     * Programmer: dlyon 
7     * Date: Dec 6, 2004 
8     * Time: 3:17:32 PM 
9     */ 
10   public class NegateOperations { 
11       public static void main(String[] args) { 
12           int a = 10; 
13           int b = -a; 
14           int c = ~a + 1 ; 
15           System.out.println("a="+Integer.toString(a)); 
16           System.out.println("b="+Integer.toString(b)); 
17           System.out.println("c="+Integer.toString(c)); 
18        } 
19   } 
20