java.lang.StrictMath হলো একটি ফাইনাল ক্লাস এবং এটি Object ক্লাসের একটি সাবক্লাস। StrictMath ক্লাসে বেসিক न्यूमেরিক অপারেশন করার জন্য মেথড থাকে যেমন елемен্টারি এক্সপোনেনশিয়াল, লগারিদম, স্কয়ার রুট, এবং ট্রাইগনোমেট্রিক ফাংশন। StrictMath ক্লাসের জন্য কোনো ইনস্ট্যান্স তৈরি করার প্রয়োজন নেই কারণ StrictMath ক্লাসের সকল মেথড স্ট্যাটিক মেথড। StrictMath ক্লাসের গুরুত্বপূর্ণ মেথডগুলো হলো abs(), acos(), asin(), atan(), ceil(), floor(), log(), max(), min(), pow(), random(), round() ইত্যাদি।
সিনট্যাক্স
public final class StrictMath extends Object
উদাহরণ
public class StrictMathTest {
public static void main(String args[]) {
System.out.println("Absolute Value: " + StrictMath.abs(-100.50));
System.out.println("Ceil Value : " + StrictMath.ceil(100.55));
System.out.println("Floor Value : " + StrictMath.floor(100.55));
System.out.println("Maximum Value : " + StrictMath.max(100,200));
System.out.println("Minimum Value : " + StrictMath.min(100,200));
System.out.println("Random Value : " + StrictMath.random());
System.out.println("Round Value: " + StrictMath.round(100.75));
System.out.println("Square Root Value : " + StrictMath.sqrt(2));
System.out.println("PI Value: " + StrictMath.PI);
System.out.println("Log Value: " + StrictMath.log(10.55));
}
}
আউটপুট
Absolute Value: 100.5 Ceil Value : 101.0 Floor Value : 100.0 Maximum Value : 200 Minimum Value : 100 Random Value : 0.22227639516105102 Round Value: 101 Square Root Value : 1.4142135623730951 PI Value: 3.141592653589793 Log Value: 2.3561258599220753