0% found this document useful (0 votes)
21 views1 page

Functii Java

The document contains several Java methods for string and array manipulation. It includes functions to find the maximum value in an array, extract substrings, check for digits, and determine the presence and last index of a dot in a string. Each method is defined with its respective functionality and return type.

Uploaded by

Diana Hartan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views1 page

Functii Java

The document contains several Java methods for string and array manipulation. It includes functions to find the maximum value in an array, extract substrings, check for digits, and determine the presence and last index of a dot in a string. Each method is defined with its respective functionality and return type.

Uploaded by

Diana Hartan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

public static int maxArr(int[] arr) {

int maxValue = arr[0];


for (int i = 1; i < arr.length; i++) {
if (arr[i] > maxValue) {
maxValue = arr[i];
}
}
return maxValue;
}

--------------------------------------------------------------------
public static String extractFirstn (String str) {
String result = " ";
for(int i=0; i<=str.length(); i++) {
result = str.substring(0,str.length());
}
return result;
}
===============================================================================

public static String extractLastn(String str) {


String result = " ";
int len = str.length();
for (int i = len - 1; i >= 0; i--) {
result = result + str.charAt(i);
}
return result;

}
===================================================================================
=

public static boolean isdigit(char ch) {


boolean b = Character.isDigit(ch);
return b;
}

================================================================

public static boolean Containsdot(String str) {


boolean b = str.contains(".");
return b;
}

===============================================================

public static int lastIndex(String str) {

int result;

result = str.lastIndexOf('.');

return result;
}
=================================================================

You might also like