Friday, May 10, 2013

Java Math Function Example



Hello Friends,

Hope you will like this article.

In this article we will be familiar with maths functions of java. Here example is given and by running this example code to your pc, you will easily get and be familiar with all these functions.


package mathsfunctions;

public class MathsFunctions {

    public static void main(String args[]){

    int i = 2;
    int j = -4;
    double x = 19.8;
    double y = 0.38;

    System.out.println("i is " + i);
    System.out.println("j is " + j);
    System.out.println("x is " + x);
    System.out.println("y is " + y);


    /*
     Math.round(variable) Function
     -----------------------------
      It gives rounding value of variable, depending upon value of variable is
      less than or greater than 0.50

     */

    System.out.println("Value of Math.round(x) is : "+Math.round(x));
    System.out.println("Value of Math.round(y) is : "+Math.round(y));
    //  ----------------------------------------------------------------------------

    /*
     Math.abs(variable) Function
     ---------------------------
     It gives integer value of variable, if it is negatie than it converts
     to positive number
     */

    System.out.println("Value of Math.abs(i) is : " + Math.abs(i));
    System.out.println("Value of Math.abs(j) is : " + Math.abs(j));
    System.out.println("Value of Math.abs(x) is : " + Math.abs(x));
    System.out.println("Value of Math.abs(y) is : " + Math.abs(y));

    //  ---------------------------------------------------------------------------

    /*
     Math.min(var1,var2) Function
     ----------------------------
     It gives minimum number value between the two variables
     */

     System.out.println("Minimum between " +i+" and j " +j+ " is : "  + Math.min(i,j));
     System.out.println("Minimum between " +x+" and j " +y+ " is : "  + Math.min(x,y));
     System.out.println("Minimum between " +i+" and j " +x+ " is : "  + Math.min(i,x));
     System.out.println("Minimum between " +y+" and j " +j+ " is : "  + Math.min(y,j));

     //  ---------------------------------------------------------------------------

     /*
     Math.max(var1,var2) Function
     ----------------------------
     It gives maximum number value between the two variables
     */

     System.out.println("Maximum between " +i+" and j " +j+ " is : "  + Math.max(i,j));
     System.out.println("Maximum between " +x+" and j " +y+ " is : "  + Math.max(x,y));
     System.out.println("Maximum between " +i+" and j " +x+ " is : "  + Math.max(i,x));
     System.out.println("Maximum between " +y+" and j " +j+ " is : "  + Math.max(y,j));

     //  ---------------------------------------------------------------------------

     /*
      Math.ceil(variable)
      -------------------
      It gives integer value greater than or equal to the number
      */

     System.out.println("Value of Math.ceil(i) is : " + Math.ceil(i));
     System.out.println("Value of Math.ceil(j) is : " + Math.ceil(j));
     System.out.println("Value of Math.ceil(x) is : " + Math.ceil(x));
     System.out.println("Value of Math.ceil(y) is : " + Math.ceil(y));

     //  ---------------------------------------------------------------------------

     /*
      Math.floor(variable)
      -------------------
      It gives integer value less than or equal to the number
      */

     System.out.println("Value of Math.floor(i) is : " + Math.floor(i));
     System.out.println("Value of Math.floor(j) is : " + Math.floor(j));
     System.out.println("Value of Math.floor(x) is : " + Math.floor(x));
     System.out.println("Value of Math.floor(y) is : " + Math.floor(y));

     //  ---------------------------------------------------------------------------

     /*
      Math.pow(var1,var2)
      -------------------
      It gives var1 raised to var2 value
      */

    System.out.println("Value of pow(3.0, 2.0) is : "  + Math.pow(3.0,2.0));
    System.out.println("Value of pow(5.0, 1.5) is : "  + Math.pow(5.0,1.5));
    System.out.println("Value of pow(3, -1) is : "     + Math.pow(3,-1));

    //  ---------------------------------------------------------------------------

     /*
      Math.sqrt(variable)
      -------------------
      It gives square value root of variable
      */

    for (i=0; i < 10; i++) {
      System.out.println(
       "The square root of " + i + " is " + Math.sqrt(i));
    }

    //  ---------------------------------------------------------------------------

     /*
      Math.random(variable)
      -------------------
      It gives random number between o to 9
      */

    System.out.println("Example of Random Number : " + Math.random());
    System.out.println("Example of another Random Number : " + Math.random());

    }
}



Thursday, April 18, 2013

What will happen of your Google Account when you Die ?



What will happened of your Gmail Account when you die ?

Have you think like this before, I don't think so. But as Gmail.com is very popular website for sending email. Google has think that if people die then what to do with his/her data ? Answer came into the mind that Can we give access to another person from user's relative or friends whom he/she trust.

Google has started their search engine before 10 years and become popular. After launching successful search engine google has started a number of products and counting...  Do you aware that how many products are launched by the google ? We will give you brief summary of the same in the forthcoming article.
 
If you have google account and you are using more than 10 Applications from google.com then you have to think that what will happen if you die and your account is locked then you may loose some important conversations or documents as you are using number of google products.

So Finally Google came up with the "Google Inactive" Option. Here you need to setup the person details to whom you would like to give access if you die or you are enable to access your google account for few months or more.

To setup Google Inactive Click here