Buggy code:
public class FileSystemCore { private static final int BITMAP_BLOCK_INDEX = 0 ; private static FileSystemCore _fileSystem = null ; private PackableMemory _packMem = null ; private IOSystemCore _iosystem = null ; private int [ ] _mask = null ; private int _maxFileLength ; private int _directoryEntrySize ; private int _maxFileNum ; private Vector < String > _directoryFileNames = null ; private HashMap < String , Integer > _filenameAndIndexMap = null ; private DescriptorPosition [ ] _descriptorPositions = null ; private OpenFileRow [ ] _openFileTable = null ; private static final int BITS_PER_INTEGER = 32 ; private static final int DATA_BLOCK_START = 7 ; private static final int INTEGER_PER_DESCRIPTOR = 4 ; private static final int INTEGER_PER_FILE_DIRECTORY = 2 ; private static final int BLOCK_PER_DESCRIPTOR = 3 ; public static final int OFT_SIZE = 4 ; public static final int ERROR_INDEX = - 1 ; private static final int MAX_FILENAME_LENGTH = 4 ; private static final int FILE_SYSTEM_INDEX = 0 ; public static FileSystemCore getObject ( ) { } private FileSystemCore ( ) { } public boolean create ( String filename ) { } public boolean destroy ( String filename ) { } public int open ( String filename ) { } public boolean close ( int index ) { } public String read ( int index , int count ) { } public boolean write ( int index , String writeString , int count ) { } public boolean lseek ( int index , int pos ) { } public String [ ] directory ( ) { } public boolean init ( String filename ) { } public boolean save ( String filename ) { } private boolean writeFile ( Path dir , byte [ ] fileArray ) { } private boolean loadFile ( Path dir ) { } private byte [ ] initializeFileArray ( ) { } private int [ ] initializeBitmap ( ) { } private boolean initializeLDisk ( byte [ ] fileArray ) { } private byte [ ] getAllLDiskDatas ( ) throws LDiskOutOfBoundaryException { } private void initializeMask ( ) { } private void initializeDescriptors ( ) { } private void initializeOpenFileTable ( ) { } private boolean closeOdtBuffer ( int odtIndex ) { } private boolean saveOdtBuffer ( int odtIndex ) { } private boolean updateFileLengthInDescriptor ( int descriptorIndex , int fileLength ) { } private int getFileLengthInDescriptor ( int descriptorIndex ) { } private boolean clearDescriptor ( int descriptorIndex ) { } private boolean removeBitInBitmap ( int dataBlockIndex ) { } private boolean updateFileLengthToOft ( int openFileTableIndex ) { } private boolean prepareOft ( int openFileTableIndex ) { } private boolean updateOdtBufferAndBlock ( int openFileTableIndex ) { } private int getCurrentBlockFromDescriptor ( int descriptorIndex , int curPosition ) { } private int getAndUpdateFreeDescriptorIndex ( ) { } private int allocateFreeBlock ( ) { } private boolean initializeDirectory ( int index ) { } private String readOftRow ( int index , int end , boolean isDirectory ) { if ( ! isDirectory ) { return null ; } StringBuffer readBuffer = new StringBuffer ( "" ) ; int bufferLength = _openFileTable [ index ] . getBufferLength ( ) ; int startPoint = _openFileTable [ index ] . getCurrentPosition ( ) ; end = startPoint + end ; int blockNum = end // bufferLength ; if ( blockNum < ( FileSystemCore . BLOCK_PER_DESCRIPTOR ) ) { blockNum ++ ; } else if ( blockNum > ( FileSystemCore . BLOCK_PER_DESCRIPTOR ) ) { return null ; } for ( int i = 1 ; i <= blockNum ; i ++ ) { int length = bufferLength ; if ( i == blockNum ) { length = end - ( ( blockNum - 1 ) * bufferLength ) ; } if ( length <= startPoint ) { startPoint -= length ; continue ; } int blockIndex = getCurrentBlockFromDescriptor ( index , i ) ; if ( blockIndex == 1 ) { return null ; } try { byte [ ] fileBlock = _iosystem . read_block ( blockIndex ) ; _packMem . setMemory ( fileBlock ) ; Vector < Byte > readBytes = new Vector < Byte > ( length ) ; int pos = startPoint ; while ( pos < length ) { if ( isDirectory ) { String readString = readForDirectory ( fileBlock , pos ) ; readBuffer . append ( readString ) ; <START_BUG> pos += PackableMemory . BYTE_PER_INT ; <END_BUG> } else { readBytes . add ( fileBlock [ pos ] ) ; pos ++ ; } } if ( ! isDirectory ) { byte [ ] readBytesArray = new byte [ readBytes . size ( ) ] ; for ( int j = 0 ; j < ( readBytes . size ( ) ) ; j ++ ) { readBytesArray [ j ] = readBytes . get ( j ) . byteValue ( ) ; } readBuffer . append ( new String ( readBytesArray ) ) ; } _openFileTable [ index ] . setCurrentBlockIndex ( blockIndex ) ; _openFileTable [ index ] . setBuffer ( fileBlock ) ; startPoint = 0 ; } catch ( LDiskOutOfBoundaryException e ) { return null ; } } _openFileTable [ index ] . setCurrentPosition ( end ) ; return readBuffer . toString ( ) ; } private String readForDirectory ( byte [ ] fileBlock , int pos ) { } private String extractFilename ( byte [ ] saveBytes ) { } private byte [ ] retrieveDirEntryByteArray ( String filename , int descriptorIndex ) { } private boolean updateDirectoryBuffer ( int openFileTableIndex , int start , int length , byte [ ] readBytes , byte [ ] saveBytes ) { } private boolean updateOftBuffer ( int index , int count , byte [ ] writeBytes , int start ) { } }

Fix:
pos += ( PackableMemory . BYTE_PER_INT ) * ( FileSystemCore . INTEGER_PER_FILE_DIRECTORY ) ;