MCPcopy Create free account
hub / github.com/DiUS/java-faker / isbn10CheckDigit

Method isbn10CheckDigit

src/main/java/com/github/javafaker/Code.java:121–128  ·  view source on GitHub ↗
(CharSequence t)

Source from the content-addressed store, hash-verified

119 }
120
121 private final int isbn10CheckDigit(CharSequence t) {
122 String value = stripIsbnSeparator(t);
123 int sum = 0;
124 for (int i = 0; i < value.length(); i++) {
125 sum += ((i + 1) * toInt(value.substring(i, i + 1)));
126 }
127 return sum % 11;
128 }
129
130 private final int isbn13CheckDigit(CharSequence t) {
131 String value = stripIsbnSeparator(t);

Callers 1

isbn10Method · 0.95

Calls 1

stripIsbnSeparatorMethod · 0.95

Tested by

no test coverage detected