Given the following Datatype
public class FileDefinition
{
public String headercode;
public String text;
public String fileext;
public int readNumBytes;
public FileDefinition(String headercode, String fileext, String text, int readNumBytes)
{
this.headercode = headercode;
this.fileext = fileext;
this.text = text;
this.readNumBytes = readNumBytes;
}
}
I have something like this:
knownfiles[90] = new FileDefinition(
"^2E524543",
"ivr",
"RealPlayer video file (V11 and later)",
DEFAULT_READ_BYTES
);
knownfiles[89] = new FileDefinition(
"^.{2,4}2D6C68",
"lha",
"Compressed archive file",
DEFAULT_READ_BYTES
);
knownfiles[88] = new FileDefinition(
"^2A2A2A2020496E7374616C6C6174696F6E205374617274656420",
"log",
"Symantec Wise Installer log file",
DEFAULT_READ_BYTES
);
Question: How do i sort by the "headercode" field?
FileDefinition[] filedefs = clsFiledefs.getFileDefinitions();
FileDefinition[] filedefs2 = SOMEMAGIC(filedefs);
I need it to get my array ordered by the longest field to the shortest.
I have tried to Array.Sort(X,y)
, but that did not work.
Thanks in advance for all answers.