Chapter 4 slides Flashcards
express exponent?
Math.exp(double a)
express natural log?
Math.log(double a)
express 10 based log?
Math.log10(double a)
express power?
Math,pow(double a, double b)
express square root?
Math.sqrt(double a)
round up to nearest integer?
Math.ceil(double a)
round down to nearest integer?
Math.floor(double a)
round to nearest integer?
Math.rint(double a)
return the max of two parameters?
Math.max(a, b)
return the minimum of two parameters?
Math.min(a,b)
return the absolute value of a parameter?
Math.abs(a)
generate a random double value greater than or equal to one parameter and less than another parameter?
a + Math.random() * b
Unicode
16 bit encoding scheme which takes two bytes, preceded by /u, expressed in four hexadecimal numbers that run from \u0000 to \uFFFF, so unicode can represent 65535 + 1 characters
ASCII code - ‘0’ to ‘9’
code value in decimal = 48 to 57
Unicode value = \uu30 to /uu0039
ASCII code ‘A’ to ‘Z’
code value in decimal = 65 to 90
Unicode value = \u0041 to \u005A
ASCII code ‘a’ to ‘z’
code value in decimal = 97 to 122
Unicode value = \u0061 to \u007A
isDigit(ch)
returns true if the specified character is a digit
isLetter(ch)
returns true if the specified character is a letter
isLetterOfDigit
returns true of the specified character is a letter or digit
isLowerCase(ch)
returns true if the specified character is a lowercase letter
isUpperCase(ch)
returns true if the specified character is an upper character
toUpperCase(ch)
returns the uppercase of the specified character
to represent a string of characters, use…
a String, ex. String message = “Welcome to Java”
length()
returns the number of characters in this string
charAt(index)
returns the character at the specified index from this string
concat(s1)
returns a new string that concatenates this string with string s1
toUpperCase()
returns a new string with all letters in uppercase
toLowerCase()
returns a new string with all letters in lowercase