Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String toProperCase(String s) {
- String firstLetter;
- s = s.trim();
- firstLetter = s.substring(0, 1).toUpperCase();
- return firstLetter + s.substring(1).toLowerCase();
- }
- // Double array length and save data(for Participant array)
- public Event[] doubleArrayLength(Event[] a) {
- Event[] newArray;
- // Create new array with double length
- newArray = new Event[a.length * 2];
- // Transfer all data to new array
- for (int i = 0; i < a.length; i++) {
- if (a[i] != null)
- newArray[i] = a[i];
- }
- return newArray;
- }
- public static boolean validateEmptyString(String input) {
- if (input.equals("") || input.trim().length() == 0) {
- System.out.println("Value can't be empy!");
- return false;
- } else
- return true;
- }
- public static boolean validateEmptyInt(Integer input) {
- if (input == null) {
- System.out.println("Value can't be empy!");
- return false;
- } else
- return true;
- }
- // Add one row and save data (for int matrix)
- public static int[][] incrementMatrixRowLength(int[][] a) {
- int[][] newArray;
- // Create new array with double length
- newArray = new int[a.length + 1][4];
- // Transfer all data to new array
- for (int i = 0; i < a.length; i++) {
- for (int j = 0; j < a[0].length; j++) {
- newArray[i][j] = a[i][j];
- }
- }
- return newArray;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement