mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 13:04:05 -08:00
Added handy toString() methods
git-svn-id: https://zxing.googlecode.com/svn/trunk@401 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
5c705313bb
commit
c2c8b2fcfb
|
@ -153,5 +153,16 @@ public final class BitArray {
|
|||
}
|
||||
return new int[arraySize];
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer result = new StringBuffer(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (i % 8 == 0) {
|
||||
result.append(' ');
|
||||
}
|
||||
result.append(get(i) ? 'X' : '.');
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -115,4 +115,15 @@ public final class BitMatrix {
|
|||
return bits;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer result = new StringBuffer(dimension * (dimension + 1));
|
||||
for (int i = 0; i < dimension; i++) {
|
||||
for (int j = 0; j < dimension; j++) {
|
||||
result.append(get(i, j) ? 'X' : ' ');
|
||||
}
|
||||
result.append('\n');
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue