Java programming 56-method exercises
Chen yuefeng, Zhengzhou game college
From: http://blog.csdn.net/mailbomb
7.9 method exercises
Requirement: Compile the corresponding function method and call the function of the test method to determine whether to implement the function.
1. Evaluate the absolute value of the byte type. Whether the following data testing methods are complete and reasonable:-10, 0, 100,-128.
2. Convert lowercase to uppercase. If the character is not lowercase, the system returns itself. Test data: 'A', 'F', and '2 '.
3. Calculate the sum of all elements in the integer array. Test data: {1}, {0, 3, 2, 12 }.
4. Rounding a decimal number to an integer. Test data: 0.1, 1.7
5. Sort arrays in ascending order (from small to large. Test data: {3, 10, 9, 2, 3}
6. Print all the even numbers between 1 and. 10 digits are displayed on each line, and the numbers are right aligned.
7. Convert the corresponding numeric characters (such as '1' and '4') to the corresponding numeric (such as 1 and 4). If the conversion fails,-1 is returned. Test data: '5', 'A', and ','-'.