Buggy code:
public class NexusGroupData implements Serializable { private static final transient Logger logger = LoggerFactory . getLogger ( NexusGroupData . class ) ; private Serializable data ; public int [ ] dimensions ; public int [ ] chunkDimensions = null ; private int dtype ; public Integer compressionType = null ; public boolean isDetectorEntryData = false ; private boolean isUnsigned = false ; private int textLength = - 1 ; public static final int MAX_TEXT_LENGTH = 255 ; private static final Charset UTF8 = Charset . forName ( "UTF-8" ) ; NexusGroupData ( ) { } NexusGroupData ( int [ ] dimensions , int dtype , Serializable data ) { } NexusGroupData ( int [ ] dimensions , Class < ? > clazz ) { } protected NexusGroupData ( IDataset data ) { } NexusGroupData ( int [ ] dimensions , Serializable data ) { } public static NexusGroupData createFromDataset ( IDataset dataset ) { } public void setMaxStringLength ( int length ) { } private static Serializable makeBytes ( String [ ] text , int maxLength ) { int n = text . length ; byte [ ] [ ] lines = new byte [ n ] [ ] ; int max = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { String t = text [ i ] ; if ( t == null ) continue ; byte [ ] l = t . getBytes ( NexusGroupData . UTF8 ) ; if ( maxLength > 0 ) { if ( ( l . length ) != maxLength ) { l = Arrays . copyOf ( l , maxLength ) ; } } max = Math . max ( max , l . length ) ; lines [ i ] = l ; } byte [ ] bdata = new byte [ n * max ] ; int k = 0 ; for ( int i = 0 ; i < n ; i ++ ) { <START_BUG> System . arraycopy ( lines [ i ] , 0 , bdata , k , max ) ; <END_BUG> k += max ; } return bdata ; } private static int getMaxLength ( String [ ] text ) { } private static String [ ] makeStrings ( byte [ ] bdata , int maxLength ) { } public NexusGroupData ( String s ) { } public NexusGroupData ( int length , String ... s ) { } public NexusGroupData ( int length , int [ ] dims , String [ ] s ) { } public NexusGroupData ( byte ... b ) { } public NexusGroupData ( int [ ] dims , byte ... b ) { } public NexusGroupData ( short ... s ) { } public NexusGroupData ( int [ ] dims , short ... s ) { } public NexusGroupData ( short [ ] [ ] s ) { } public NexusGroupData ( int i ) { } public NexusGroupData ( int ... i ) { } public NexusGroupData ( int [ ] dims , int ... i ) { } public NexusGroupData ( int [ ] [ ] i ) { } public NexusGroupData ( int [ ] [ ] [ ] i ) { } public NexusGroupData ( long ... l ) { } public NexusGroupData ( int [ ] dims , long ... l ) { } public NexusGroupData ( boolean b ) { } public NexusGroupData ( float ... f ) { } public NexusGroupData ( int [ ] dims , float ... f ) { } public NexusGroupData ( double ... d ) { } public NexusGroupData ( int [ ] dims , double ... d ) { } public NexusGroupData ( double [ ] [ ] d ) { } public NexusGroupData ( double [ ] [ ] [ ] d ) { } public NexusGroupData setUnsigned ( ) { } public boolean isChar ( ) { } public Serializable getBuffer ( ) { } public Serializable getBuffer ( boolean encode ) { } public Object releaseData ( ) { } @ Override public String toString ( ) { } private String getAsString ( ) { } public String dataToTxt ( boolean newlineAfterEach , boolean dataAsString , boolean wrap ) { } public Serializable getFirstValue ( ) { } public ILazyWriteableDataset toLazyDataset ( ) { } public Dataset toDataset ( ) { } public Dataset toDataset ( boolean keepBitWidth ) { } public int getDtype ( ) { } public String getType ( ) { } private static Serializable getFromArray ( Serializable array ) { } private static String getStringFromArray ( Serializable array ) { } @ Override public boolean equals ( Object obj ) { } public boolean equals ( Object obj , boolean logWhenFalseInOneCase ) { } private NexusGroupData asType ( int type ) { } public int [ ] getDimensions ( ) { } public NexusGroupData asChar ( ) { } public NexusGroupData asByte ( ) { } public NexusGroupData asShort ( ) { } public NexusGroupData asInt ( ) { } public NexusGroupData asLong ( ) { } public NexusGroupData asFloat ( ) { } public NexusGroupData asDouble ( ) { } public boolean isFloat ( ) { } public boolean isDouble ( ) { } }

Fix:
System . arraycopy ( lines [ i ] , 0 , bdata , k , lines [ i ] . length ) ;