Useful Java Built-in Methods
1. Math Class Methods
- [Link](x): Absolute value. Example: [Link](-5) => 5
- [Link](a, b): Larger of two values. Example: [Link](3, 8) => 8
- [Link](a, b): Smaller of two values. Example: [Link](3, 8) => 3
- [Link](x, y): Power. Example: [Link](2, 3) => 8.0
- [Link](x): Square root. Example: [Link](9) => 3.0
- [Link](x): Cube root. Example: [Link](27) => 3.0
- [Link](x): Rounds to nearest int. Example: [Link](2.6) => 3
- [Link](x): Rounds up. Example: [Link](2.1) => 3.0
- [Link](x): Rounds down. Example: [Link](2.9) => 2.0
- [Link](): Random number [0.0, 1.0)
2. String Class Methods
- length(): Length of string. Example: "hello".length() => 5
- charAt(i): Char at index i. Example: "hello".charAt(1) => 'e'
- substring(i, j): Part of string i to j-1. Example: "hello".substring(1, 3) => "el"
- toLowerCase(): Convert to lower. Example: "HeLLo".toLowerCase() => "hello"
- toUpperCase(): Convert to upper. Example: "hello".toUpperCase() => "HELLO"
- equals(): Compare strings. Example: "a".equals("A") => false
- equalsIgnoreCase(): Case-insensitive compare. Example: "a".equalsIgnoreCase("A") => true
- contains(): Check if contains. Example: "abc".contains("b") => true
- replace(): Replace chars. Example: "apple".replace("p", "b") => "abble"
3. Arrays Utility Methods
- [Link](arr): Sort the array.
- [Link](arr): Convert array to string format.
- [Link](arr, n): Copy first n elements.