Here you can find the source of sqr(int x)
Parameter | Description |
---|---|
x | the number |
public static int sqr(int x)
//package com.java2s; /*/*ww w. j a va 2 s . c o m*/ * ArikTools * Copyright (C) Arik Z.Lakritz, Peter Macko, and David K. Wittenberg * * This file is part of ArikTools. * * ArikTools is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ArikTools is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ArikTools. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Calculate a square of a number * * @param x the number * @return x^2 */ public static int sqr(int x) { return x * x; } /** * Calculate a square of a number * * @param x the number * @return x^2 */ public static long sqr(long x) { return x * x; } /** * Calculate a square of a number * * @param x the number * @return x^2 */ public static float sqr(float x) { return x * x; } /** * Calculate a square of a number * * @param x the number * @return x^2 */ public static double sqr(double x) { return x * x; } }