0% found this document useful (0 votes)
16 views

Functii Java

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)
16 views

Functii Java

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