public void testRemoveLast() {
		ByteArrayBuilder builder = new ByteArrayBuilder();
		byte[] testdata = new byte[777];
		for(int i=0;i<testdata.length;i++) {
			testdata[i] = (byte)i;
		}

		builder.clear();
		for(int i=0;i<testdata.length;i++) {
			assertEquals(i, builder.length());
			builder.append(testdata[i]);
			// check
			{
				byte[] result = builder.getBuffer(); 
				int s = 0;
				int e = builder.length();
				assertEquals(i+1, e);
				if(i==0||i%LEVEL==0){
					for(int j=s;j<e;j++) {
						assertEquals((byte)j, result[j]);
					}
				}
			}
		}
		for(int i=0;i<testdata.length;i++) {
			builder.removeLast();
			// check
			{
				byte[] result = builder.getBuffer(); 
				int s = 0;
				int e = builder.length();
				assertEquals(testdata.length-i-1, e);
				if(i==0||i%LEVEL==0){
					for(int j=s;j<e;j++) {
						assertEquals((byte)j, result[j]);
					}
				}
			}
		}
	}