Here is a simple Java function example:

public static int add(int a, int b) {
  int sum = a + b;
  return sum;
}

This function takes two integer parameters, a and b, adds them together and returns the sum. The public keyword means that the function can be accessed from outside the class it's defined in, and the static keyword means that it can be called without creating an instance of the class. The return type of the function is int, which means that it returns an integer value.

To use this function, you would call it from another part of your code like this:

int result = add(2, 3);
System.out.println(result);

This would output 5, which is the result of adding 2 and 3 together

simple java function example