Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Calculator {
- public int add(int a, int b) {
- return a + b ;
- }
- public int min(int a, int b, int c) {
- if (a < b && a < c) {
- return a;
- } else if (b < c) {
- return b;
- }
- return c;
- }
- public String concat(String str1, String str2) {
- return str1 + str2;
- }
- public void bubbleSort(int[] arr) {
- int n = arr.length;
- for (int i = 0; i < n-1; i++) {
- for (int j = 0; j < n-i-1; j++) {
- if (arr[j] > arr[j+1])
- {
- // swap arr[j+1] and arr[j]
- int temp = arr[j];
- arr[j] = arr[j+1];
- arr[j+1] = temp;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement