Merge branch 'master' of oss.readytalk.com:/var/local/git/avian into powerpc

This commit is contained in:
Joel Dice 2008-09-06 19:40:50 -06:00
commit 42123c4c8c
4 changed files with 14 additions and 2 deletions

View File

@ -38,7 +38,7 @@ public class BufferedInputStream extends InputStream {
}
}
return buffer[position++];
return buffer[position++] & 0xFF;
}
public int read(byte[] b, int offset, int length) throws IOException {

View File

@ -128,15 +128,19 @@ public final class Long extends Number implements Comparable<Long> {
int i = 0;
long number = 0;
boolean negative = s.startsWith("-");
int length = s.length();
if (negative) {
i = 1;
-- length;
}
long factor = pow(radix, length - 1);
for (; i < s.length(); ++i) {
char c = s.charAt(i);
int digit = Character.digit(c, radix);
if (digit >= 0) {
number += digit * pow(radix, (s.length() - i - 1));
number += digit * factor;
factor /= radix;
} else {
throw new NumberFormatException("invalid character " + c + " code " +
(int) c);

View File

@ -66,6 +66,10 @@ public class HashSet<T> implements Set<T> {
return new MyIterator(map.iterator());
}
public String toString() {
return Collections.toString(this);
}
private static class MyIterator<T> implements Iterator<T> {
private final Iterator<Map.Entry<T, Object>> it;

View File

@ -102,6 +102,10 @@ public class Misc {
expect(foo > 0);
}
expect(Long.parseLong("25214903884") == 25214903884L);
expect(Long.parseLong("-9223372036854775808") == -9223372036854775808L);
expect(String.valueOf(25214903884L).equals("25214903884"));
expect(String.valueOf(-9223372036854775808L).equals