1 Appendable interface
If an instance of a class intends to receive Formatter the formatted output from, then the class must implement the appendable interface.
Java.lang's StringBuffer, StringBuilder implements the interface.
Formatting is primarily used for text output, such as numbers, dates, amounts, and so on.
2 7064:1983.mod 11-2 algorithm
The following can explain why there is an x in the ID check code.
The main application of this algorithm is ID check code. A checksum is usually the last digit of a set of numbers, which is calculated by an operation of the preceding number to verify the correctness of the set of numbers. The function of ID card check code is to calculate the first 17 digits of the ID card to get the 18th position, in order to test the correctness of the group's numbers preliminarily.
The algorithm function is constructed in mod ((2^ (i-1) * ai), 11), this I is ID 17 bits data from left to right number, from 1~17. Sigma (xi) represents x1+x2+......+x17.
Here and the specific results of this algorithm may not be the same, I, the arrangement of the results after the modulo inverse (such as 5%11=5, take the inverse (12-5)%11 = 7), etc., ignoring these differences.
In doing so, the checksum code to 17 bits of one of the error is can be verified, the two-bit is not the same position error can be verified, to three more than some, it can be verified. Since the probability of an error is much higher than the two-bit far higher than the three-bit, the algorithm's verification capability should be very strong (unless deliberately designed).
So the last one of the algorithm added x, so that the ability to verify the capacity to increase to 11 and the number of digits of the ID 17 is not related, but with each bit of the system has a relationship. That is, if each digit range is 0~6, the check code is 0~7.
Of course, there is a problem here, if the follow-up system, 0~9 also only need 10 kinds of identification to distinguish, the check code represents a possible value of at least 10, rather than 11. This is because the probability of check code is 10 o'clock, and the modulus may be problematic,A1 is odd, the result is an odd number. This is related to its base 2, which means that the number of possible values of the check code and the base should be orthogonal. This should be the meaning of 11-2 in the algorithm name.
Thus, we can construct a 10-3 algorithm so that there is no need to have X on the ID card. However, compared with 11-2, 10-3 has a disadvantage: the current memory data in 2 binary storage, 11-2 algorithm pairs have two bits (adjacent bits? ), the detection rate is higher (visual).