Home | History | Annotate | Download | only in src
      1 /*
      2  * Copyright (C) 2007 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 /**
     18  * test simple math opers
     19  */
     20 public class Main {
     21     public static void main(String args[]) {
     22         int pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7;
     23         int pad8, pad9, pad10, pad11, pad12, pad13, pad14, pad15;
     24         int a, b, res;
     25         //long a, b, res;
     26 
     27         a = 3;
     28         b = 7;
     29 
     30         res = a + b;
     31         System.out.println("res:" +res);
     32         res = a - b;
     33         System.out.println("res:" +res);
     34         res = 5 - a;
     35         System.out.println("res:" +res);
     36         res = a - 5;
     37         System.out.println("res:" +res);
     38         res = a * b;
     39         System.out.println("res:" +res);
     40         res = a / b;
     41         System.out.println("res:" +res);
     42         res = a % b;
     43         System.out.println("res:" +res);
     44         res = a ^ b;
     45         System.out.println("res:" +res);
     46         res = a << b;
     47         System.out.println("res:" +res);
     48         res = a >> b;
     49         System.out.println("res:" +res);
     50         res = a >>> b;
     51         System.out.println("res:" +res);
     52 
     53         a += b;
     54         System.out.println("a:" +a);
     55         a -= b;
     56         System.out.println("a:" +a);
     57         a = 5 - a;
     58         System.out.println("a:" +a);
     59         a -= 5;
     60         System.out.println("a:" +a);
     61         a *= b;
     62         System.out.println("a:" +a);
     63         a /= b;
     64         System.out.println("a:" +a);
     65         a %= b;
     66         System.out.println("a:" +a);
     67         a ^= b;
     68         System.out.println("a:" +a);
     69         a <<= b;
     70         System.out.println("a:" +a);
     71         a >>= b;
     72         System.out.println("a:" +a);
     73         a >>>= b;
     74         System.out.println("a:" +a);
     75 
     76         double f, g, fres;
     77 
     78         f = 3.0f;
     79         g = 7.0f;
     80 
     81         fres = f + g;
     82         System.out.println("fres:" +fres);
     83         fres = f - g;
     84         System.out.println("fres:" +fres);
     85         fres = f * g;
     86         System.out.println("fres:" +fres);
     87         fres = f / g;
     88         System.out.println("fres:" +fres);
     89         fres = f % g;
     90         System.out.println("fres:" +fres);
     91         f += g;
     92         System.out.println("f:" +f);
     93         f -= g;
     94         System.out.println("f:" +f);
     95         f *= g;
     96         System.out.println("f:" +f);
     97         f /= g;
     98         System.out.println("f:" +f);
     99         f %= g;
    100         System.out.println("f:" +f);
    101     }
    102 }
    103