yijunyu/c-to-rust huggingface dataset:
// Original:
public List<String> getRuleInvocationStack(RuleContext p) {String[] ruleNames = getRuleNames();List<String> stack = new ArrayList<String>();while ( p!=null ) {int ruleIndex = p.getRuleIndex();if ( ruleIndex<0 ) stack.add("n/a");else stack.add(ruleNames[ruleIndex]);p = p.parent;}return stack;}

// Translation:
public virtual IList<string> GetRuleInvocationStack(RuleContext p){string[] ruleNames = RuleNames;IList<string> stack = new List<string>();while (p != null){int ruleIndex = p.RuleIndex;if (ruleIndex < 0){stack.Add("n/a");}else{stack.Add(ruleNames[ruleIndex]);}p = p.Parent;}return stack;}
// Original:
static public double ipmt(double r, int per, int nper, double pv, double fv) {return ipmt(r, per, nper, pv, fv, 0);}

// Translation:
static public double IPMT(double r, int per, int nper, double pv, double fv){return IPMT(r, per, nper, pv, fv, 0);}
// Original:
public int countRanges() {return _list.size();}

// Translation:
public int CountRanges(){return _list.Count;}
// Original:
public int compareTo(FormatRun r) {if (_character == r._character && _fontIndex == r._fontIndex) {return 0;}if (_character == r._character) {return _fontIndex - r._fontIndex;}return _character - r._character;}

// Translation:
public int CompareTo(FormatRun r){if (_character == r._character && _fontIndex == r._fontIndex){return 0;}if (_character == r._character){return _fontIndex - r._fontIndex;}return _character - r._character;}
// Original:
public final void readFully(byte[] dst) throws IOException {readFully(dst, 0, dst.length);}

// Translation:
public virtual void readFully(byte[] dst){throw new System.NotImplementedException();}
// Original:
public synchronized int size() {return size;}

// Translation:
public override int size(){lock (this){return _size;}}
// Original:
public String group() {return group(0);}

// Translation:
public string group(){return group(0);}
// Original:
public int getExternalSheetIndex(String workbookName, String firstSheetName, String lastSheetName) {return getOrCreateLinkTable().getExternalSheetIndex(workbookName, firstSheetName, lastSheetName);}

// Translation:
public int GetExternalSheetIndex(String workbookName, String firstSheetName, String lastSheetName){return OrCreateLinkTable.GetExternalSheetIndex(workbookName, firstSheetName, lastSheetName);}
// Original:
public GetDeliverabilityTestReportResult getDeliverabilityTestReport(GetDeliverabilityTestReportRequest request) {request = beforeClientExecution(request);return executeGetDeliverabilityTestReport(request);}

// Translation:
public virtual GetDeliverabilityTestReportResponse GetDeliverabilityTestReport(GetDeliverabilityTestReportRequest request){var options = new InvokeOptions();options.RequestMarshaller = GetDeliverabilityTestReportRequestMarshaller.Instance;options.ResponseUnmarshaller = GetDeliverabilityTestReportResponseUnmarshaller.Instance;return Invoke<GetDeliverabilityTestReportResponse>(request, options);}
// Original:
public boolean isPeeled() {return getLeaf().isPeeled();}

// Translation:
public virtual bool IsPeeled(){return GetLeaf().IsPeeled();}
// Original:
public RenameCallback getRenameCallback() {return renameCallback;}

// Translation:
public virtual RenameCallback GetRenameCallback(){return renameCallback;}
// Original:
public String toString() {return "EditList" + super.toString(); }

// Translation:
public override string ToString(){return "EditList[]";}
// Original:
public PutVoiceConnectorTerminationCredentialsResult putVoiceConnectorTerminationCredentials(PutVoiceConnectorTerminationCredentialsRequest request) {request = beforeClientExecution(request);return executePutVoiceConnectorTerminationCredentials(request);}

// Translation:
public virtual PutVoiceConnectorTerminationCredentialsResponse PutVoiceConnectorTerminationCredentials(PutVoiceConnectorTerminationCredentialsRequest request){var options = new InvokeOptions();options.RequestMarshaller = PutVoiceConnectorTerminationCredentialsRequestMarshaller.Instance;options.ResponseUnmarshaller = PutVoiceConnectorTerminationCredentialsResponseUnmarshaller.Instance;return Invoke<PutVoiceConnectorTerminationCredentialsResponse>(request, options);}
// Original:
public CreateGroupResult createGroup(CreateGroupRequest request) {request = beforeClientExecution(request);return executeCreateGroup(request);}

// Translation:
public virtual CreateGroupResponse CreateGroup(CreateGroupRequest request){var options = new InvokeOptions();options.RequestMarshaller = CreateGroupRequestMarshaller.Instance;options.ResponseUnmarshaller = CreateGroupResponseUnmarshaller.Instance;return Invoke<CreateGroupResponse>(request, options);}
// Original:
public void serialize(LittleEndianOutput out) {out.writeShort(field_1_units);}

// Translation:
public override void Serialize(ILittleEndianOutput out1){out1.WriteShort(field_1_units);}
// Original:
public ObjectLoader open(AnyObjectId objectId, int typeHint)throws MissingObjectException, IncorrectObjectTypeException,IOException {final ObjectLoader ldr = db.openObject(this, objectId);if (ldr == null) {if (typeHint == OBJ_ANY)throw new MissingObjectException(objectId.copy(),JGitText.get().unknownObjectType2);throw new MissingObjectException(objectId.copy(), typeHint);}if (typeHint != OBJ_ANY && ldr.getType() != typeHint)throw new IncorrectObjectTypeException(objectId.copy(), typeHint);return ldr;}

// Translation:
public override ObjectLoader Open(AnyObjectId objectId, int typeHint){ObjectLoader ldr = db.OpenObject(this, objectId);if (ldr == null){if (typeHint == OBJ_ANY){throw new MissingObjectException(objectId.Copy(), "unknown");}throw new MissingObjectException(objectId.Copy(), typeHint);}if (typeHint != OBJ_ANY && ldr.GetType() != typeHint){throw new IncorrectObjectTypeException(objectId.Copy(), typeHint);}return ldr;}
// Original:
public ParameterNameValue(String parameterName, String parameterValue) {setParameterName(parameterName);setParameterValue(parameterValue);}

// Translation:
public ParameterNameValue(string parameterName, string parameterValue){_parameterName = parameterName;_parameterValue = parameterValue;}
// Original:
public AssociateIamInstanceProfileResult associateIamInstanceProfile(AssociateIamInstanceProfileRequest request) {request = beforeClientExecution(request);return executeAssociateIamInstanceProfile(request);}

// Translation:
public virtual AssociateIamInstanceProfileResponse AssociateIamInstanceProfile(AssociateIamInstanceProfileRequest request){var options = new InvokeOptions();options.RequestMarshaller = AssociateIamInstanceProfileRequestMarshaller.Instance;options.ResponseUnmarshaller = AssociateIamInstanceProfileResponseUnmarshaller.Instance;return Invoke<AssociateIamInstanceProfileResponse>(request, options);}
// Original:
public CreateHostedZoneRequest(String name, String callerReference) {setName(name);setCallerReference(callerReference);}

// Translation:
public CreateHostedZoneRequest(string name, string callerReference){_name = name;_callerReference = callerReference;}
// Original:
public String getPronunciation() {return dictionary.getPronunciation(wordId, surfaceForm, offset, length);}

// Translation:
public virtual string GetPronunciation(){return dictionary.GetPronunciation(wordId, surfaceForm, offset, length);}
// Original:
public boolean knows(String key) {return (find(key) >= 0);}

// Translation:
public virtual bool Knows(string key){return (Find(key) >= 0);}
// Original:
public ServerException(String errorCode, String errorMessage) {super(errorCode, errorMessage);this.setErrorType(ErrorType.Server);}

// Translation:
public ServerException(string errorCode, string errorMessage) : base(errorCode, errorMessage){ErrorType = ErrorType.Server;}
// Original:
public String toString() {return "3(" + mu + ")";}

// Translation:
public override string ToString(){return "3(" + mu + ")";}
// Original:
public CreateDiskResult createDisk(CreateDiskRequest request) {request = beforeClientExecution(request);return executeCreateDisk(request);}

// Translation:
public virtual CreateDiskResponse CreateDisk(CreateDiskRequest request){var options = new InvokeOptions();options.RequestMarshaller = CreateDiskRequestMarshaller.Instance;options.ResponseUnmarshaller = CreateDiskResponseUnmarshaller.Instance;return Invoke<CreateDiskResponse>(request, options);}
// Original:
public boolean add(char[] text) {return map.put(text, PLACEHOLDER) == null;}

// Translation:
public virtual bool Add(object o){return map.Put(o);}
// Original:
public QueryLicensesRequest() {super("LinkFace", "2018-07-20", "QueryLicenses");setProtocol(ProtocolType.HTTPS);setMethod(MethodType.POST);}

// Translation:
public QueryLicensesRequest(): base("LinkFace", "2018-07-20", "QueryLicenses"){Protocol = ProtocolType.HTTPS;Method = MethodType.POST;}
// Original:
public ExpectedAttributeValue(AttributeValue value) {setValue(value);}

// Translation:
public ExpectedAttributeValue(AttributeValue value){_value = value;}
// Original:
public long getSize() {return getCachedBytes().length;}

// Translation:
public override long GetSize(){return GetCachedBytes().Length;}
// Original:
public DescribeImageAttributeRequest(String imageId, ImageAttributeName attribute) {setImageId(imageId);setAttribute(attribute.toString());}

// Translation:
public DescribeImageAttributeRequest(string imageId, ImageAttributeName attribute){_imageId = imageId;_attribute = attribute;}
// Original:
public HSSFAnchor() {createEscherAnchor();}

// Translation:
public HSSFAnchor(){CreateEscherAnchor();}
// Original:
public V setValue(V object) {V result = value;value = object;return result;}

// Translation:
public virtual V setValue(V @object){V result = value;value = @object;return result;}
// Original:
public void readFully(byte[] buffer, int off, int len) {checkPosition(len);read(buffer, off, len);}

// Translation:
public void ReadFully(byte[] buf, int off, int len){CheckPosition(len);System.Array.Copy(_buf, _ReadIndex, buf, off, len);_ReadIndex += len;}
// Original:
public CancelDomainTransferToAnotherAwsAccountResult cancelDomainTransferToAnotherAwsAccount(CancelDomainTransferToAnotherAwsAccountRequest request) {request = beforeClientExecution(request);return executeCancelDomainTransferToAnotherAwsAccount(request);}

// Translation:
public virtual CancelDomainTransferToAnotherAwsAccountResponse CancelDomainTransferToAnotherAwsAccount(CancelDomainTransferToAnotherAwsAccountRequest request){var options = new InvokeOptions();options.RequestMarshaller = CancelDomainTransferToAnotherAwsAccountRequestMarshaller.Instance;options.ResponseUnmarshaller = CancelDomainTransferToAnotherAwsAccountResponseUnmarshaller.Instance;return Invoke<CancelDomainTransferToAnotherAwsAccountResponse>(request, options);}
// Original:
public RecognizeCelebritiesResult recognizeCelebrities(RecognizeCelebritiesRequest request) {request = beforeClientExecution(request);return executeRecognizeCelebrities(request);}

// Translation:
public virtual RecognizeCelebritiesResponse RecognizeCelebrities(RecognizeCelebritiesRequest request){var options = new InvokeOptions();options.RequestMarshaller = RecognizeCelebritiesRequestMarshaller.Instance;options.ResponseUnmarshaller = RecognizeCelebritiesResponseUnmarshaller.Instance;return Invoke<RecognizeCelebritiesResponse>(request, options);}
// Original:
public SideBandOutputStream(int chan, int sz, OutputStream os) {if (chan <= 0 || chan > 255)throw new IllegalArgumentException(MessageFormat.format(JGitText.get().channelMustBeInRange1_255,Integer.valueOf(chan)));if (sz <= HDR_SIZE)throw new IllegalArgumentException(MessageFormat.format(JGitText.get().packetSizeMustBeAtLeast,Integer.valueOf(sz), Integer.valueOf(HDR_SIZE)));else if (MAX_BUF < sz)throw new IllegalArgumentException(MessageFormat.format(JGitText.get().packetSizeMustBeAtMost, Integer.valueOf(sz),Integer.valueOf(MAX_BUF)));out = os;buffer = new byte[sz];buffer[4] = (byte) chan;cnt = HDR_SIZE;}

// Translation:
public SideBandOutputStream(int chan, int sz, OutputStream os){if (chan <= 0 || chan > 255){throw new ArgumentException(MessageFormat.Format(JGitText.Get().channelMustBeInRange0_255, Sharpen.Extensions.ValueOf(chan)));}if (sz <= HDR_SIZE){throw new ArgumentException(MessageFormat.Format(JGitText.Get().packetSizeMustBeAtLeast, Sharpen.Extensions.ValueOf(sz), Sharpen.Extensions.ValueOf(HDR_SIZE)));}else{if (MAX_BUF < sz){throw new ArgumentException(MessageFormat.Format(JGitText.Get().packetSizeMustBeAtMost, Sharpen.Extensions.ValueOf(sz), Sharpen.Extensions.ValueOf(MAX_BUF)));}}@out = os;buffer = new byte[sz];buffer[4] = unchecked((byte)chan);cnt = HDR_SIZE;}
// Original:
public LexerATNConfig(ATNState state,int alt,PredictionContext context,LexerActionExecutor lexerActionExecutor){super(state, alt, context, SemanticContext.NONE);this.lexerActionExecutor = lexerActionExecutor;this.passedThroughNonGreedyDecision = false;}

// Translation:
public LexerATNConfig(ATNState state,int alt,PredictionContext context,LexerActionExecutor lexerActionExecutor): base(state, alt, context, SemanticContext.NONE){this.lexerActionExecutor = lexerActionExecutor;this.passedThroughNonGreedyDecision = false;}
// Original:
public String format(List<RevCommit> squashedCommits, Ref target) {StringBuilder sb = new StringBuilder();sb.append("Squashed commit of the following:\n"); for (RevCommit c : squashedCommits) {sb.append("\ncommit "); sb.append(c.getName());sb.append("\n"); sb.append(toString(c.getAuthorIdent()));sb.append("\n\t"); sb.append(c.getShortMessage());sb.append("\n"); }return sb.toString();}

// Translation:
public virtual string Format(IList<RevCommit> squashedCommits, Ref target){StringBuilder sb = new StringBuilder();sb.Append("Squashed commit of the following:\n");foreach (RevCommit c in squashedCommits){sb.Append("\ncommit ");sb.Append(c.GetName());sb.Append("\n");sb.Append(ToString(c.GetAuthorIdent()));sb.Append("\n\t");sb.Append(c.GetShortMessage());sb.Append("\n");}return sb.ToString();}
// Original:
public int stem(char s[], int len) {if (len < 3 || s[len-1] != 's')return len;switch(s[len-2]) {case 'u':case 's': return len;case 'e':if (len > 3 && s[len-3] == 'i' && s[len-4] != 'a' && s[len-4] != 'e') {s[len - 3] = 'y';return len - 2;}if (s[len-3] == 'i' || s[len-3] == 'a' || s[len-3] == 'o' || s[len-3] == 'e')return len; default: return len - 1;}}

// Translation:
public virtual int Stem(char[] s, int len){if (len < 3 || s[len - 1] != 's'){return len;}switch (s[len - 2]){case 'u':case 's':return len;case 'e':if (len > 3 && s[len - 3] == 'i' && s[len - 4] != 'a' && s[len - 4] != 'e'){s[len - 3] = 'y';return len - 2;}if (s[len - 3] == 'i' || s[len - 3] == 'a' || s[len - 3] == 'o' || s[len - 3] == 'e'){return len; }break;}return len - 1;}
// Original:
public TermsQueryBuilder(Analyzer analyzer) {this.analyzer = analyzer;}

// Translation:
public TermsQueryBuilder(Analyzer analyzer){this.analyzer = analyzer;}
// Original:
public CreateDomainRequest(String domainName) {setDomainName(domainName);}

// Translation:
public CreateDomainRequest(string domainName){_domainName = domainName;}
// Original:
public Trie optimize(Trie orig) {List<CharSequence> cmds = orig.cmds;List<Row> rows = new ArrayList<>();List<Row> orows = orig.rows;int remap[] = new int[orows.size()];for (int j = orows.size() - 1; j >= 0; j--) {Row now = new Remap(orows.get(j), remap);boolean merged = false;for (int i = 0; i < rows.size(); i++) {Row q = merge(now, rows.get(i));if (q != null) {rows.set(i, q);merged = true;remap[j] = i;break;}}if (merged == false) {remap[j] = rows.size();rows.add(now);}}int root = remap[orig.root];Arrays.fill(remap, -1);rows = removeGaps(root, rows, new ArrayList<Row>(), remap);return new Trie(orig.forward, remap[root], cmds, rows);}

// Translation:
public override Trie Optimize(Trie orig){IList<string> cmds = orig.cmds;IList<Row> rows = new List<Row>();IList<Row> orows = orig.rows;int[] remap = new int[orows.Count];for (int j = orows.Count - 1; j >= 0; j--){Row now = new Remap(orows[j], remap);bool merged = false;for (int i = 0; i < rows.Count; i++){Row q = Merge(now, rows[i]);if (q != null){rows[i] = q;merged = true;remap[j] = i;break;}}if (merged == false){remap[j] = rows.Count;rows.Add(now);}}int root = remap[orig.root];Arrays.Fill(remap, -1);rows = RemoveGaps(root, rows, new List<Row>(), remap);return new Trie(orig.forward, remap[root], cmds, rows);}
// Original:
public final boolean isFirstCell(int rowIx, int colIx) {CellRangeAddress8Bit r = getRange();return r.getFirstRow() == rowIx && r.getFirstColumn() == colIx;}

// Translation:
public bool IsFirstCell(int rowIx, int colIx){CellRangeAddress8Bit r = Range;return r.FirstRow == rowIx && r.FirstColumn == colIx;}
// Original:
public CompleteLayerUploadResult completeLayerUpload(CompleteLayerUploadRequest request) {request = beforeClientExecution(request);return executeCompleteLayerUpload(request);}

// Translation:
public virtual CompleteLayerUploadResponse CompleteLayerUpload(CompleteLayerUploadRequest request){var options = new InvokeOptions();options.RequestMarshaller = CompleteLayerUploadRequestMarshaller.Instance;options.ResponseUnmarshaller = CompleteLayerUploadResponseUnmarshaller.Instance;return Invoke<CompleteLayerUploadResponse>(request, options);}
// Original:
public StopHumanLoopResult stopHumanLoop(StopHumanLoopRequest request) {request = beforeClientExecution(request);return executeStopHumanLoop(request);}

// Translation:
public virtual StopHumanLoopResponse StopHumanLoop(StopHumanLoopRequest request){var options = new InvokeOptions();options.RequestMarshaller = StopHumanLoopRequestMarshaller.Instance;options.ResponseUnmarshaller = StopHumanLoopResponseUnmarshaller.Instance;return Invoke<StopHumanLoopResponse>(request, options);}
// Original:
public RevCommit getSourceCommit() {return outCandidate.sourceCommit;}

// Translation:
public virtual RevCommit GetSourceCommit(){return currentSource.sourceCommit;}
// Original:
public synchronized Object getPerfObject(String key) {return perfObjects.get(key);}

// Translation:
public virtual object GetPerfObject(string key){lock (this){object result;perfObjects.TryGetValue(key, out result);return result;}}
// Original:
public TokenStream create(TokenStream input) {return new HindiStemFilter(input);}

// Translation:
public override TokenStream Create(TokenStream input){return new HindiStemFilter(input);}
// Original:
public static BreakIterator getWordInstance() {return getWordInstance(Locale.getDefault());}

// Translation:
public static java.text.BreakIterator getWordInstance(){return getWordInstance(System.Globalization.CultureInfo.CurrentCulture);}
// Original:
public UpdatePublicKeyResult updatePublicKey(UpdatePublicKeyRequest request) {request = beforeClientExecution(request);return executeUpdatePublicKey(request);}

// Translation:
public virtual UpdatePublicKeyResponse UpdatePublicKey(UpdatePublicKeyRequest request){var options = new InvokeOptions();options.RequestMarshaller = UpdatePublicKeyRequestMarshaller.Instance;options.ResponseUnmarshaller = UpdatePublicKeyResponseUnmarshaller.Instance;return Invoke<UpdatePublicKeyResponse>(request, options);}
// Original:
public boolean include(RevWalk walker, RevCommit c) {return c.getParentCount() < 2;}

// Translation:
public override bool Include(RevWalk walker, RevCommit c){return c.ParentCount < 2;}
// Original:
public String toString(){StringBuilder buffer = new StringBuilder();buffer.append("[COUNTRY]\n");buffer.append("    .defaultcountry  = ").append(Integer.toHexString(getDefaultCountry())).append("\n");buffer.append("    .currentcountry  = ").append(Integer.toHexString(getCurrentCountry())).append("\n");buffer.append("[/COUNTRY]\n");return buffer.toString();}

// Translation:
public override String ToString(){StringBuilder buffer = new StringBuilder();buffer.Append("[COUNTRY]\n");buffer.Append("    .defaultcountry  = ").Append(StringUtil.ToHexString(DefaultCountry)).Append("\n");buffer.Append("    .currentcountry  = ").Append(StringUtil.ToHexString(CurrentCountry)).Append("\n");buffer.Append("[/COUNTRY]\n");return buffer.ToString();}
// Original:
public DefaultColWidthRecord clone() {return copy();}

// Translation:
public override Object Clone(){DefaultColWidthRecord rec = new DefaultColWidthRecord();rec.field_1_col_width = field_1_col_width;return rec;}
// Original:
public Matcher useAnchoringBounds(boolean value) {anchoringBounds = value;useAnchoringBoundsImpl(address, value);return this;}

// Translation:
public java.util.regex.Matcher useAnchoringBounds(bool value){anchoringBounds = value;useAnchoringBoundsImpl(address, value);return this;}
// Original:
public PostingsEnum reset(int[] postings) {this.postings = postings;upto = -2;return this;}

// Translation:
public DocsEnum Reset(int[] postings){this.postings = postings;upto = -2;return this;}
// Original:
public void SwitchTo(int lexState){if (lexState >= 2 || lexState < 0)throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);elsecurLexState = lexState;}

// Translation:
public void SwitchTo(int lexState){if (lexState >= 2 || lexState < 0)throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);elsecurLexState = lexState;}
// Original:
public boolean add(final int value){if (_limit == _array.length){growArray(_limit * 2);}_array[ _limit++ ] = value;return true;}

// Translation:
public bool Add(int value){if (_limit == _array.Length){growArray(_limit * 2);}_array[_limit++] = value;return true;}
// Original:
public final int computeIterations(int valueCount, int ramBudget) {final int iterations = ramBudget / (byteBlockCount() + 8 * byteValueCount());if (iterations == 0) {return 1;} else if ((iterations - 1) * byteValueCount() >= valueCount) {return (int) Math.ceil((double) valueCount / byteValueCount());} else {return iterations;}}

// Translation:
public int ComputeIterations(int valueCount, int ramBudget){int iterations = ramBudget / (ByteBlockCount + 8 * ByteValueCount);if (iterations == 0){return 1;}else if ((iterations - 1) * ByteValueCount >= valueCount){return (int)Math.Ceiling((double)valueCount / ByteValueCount);}else{return iterations;}}
// Original:
public NameRecord getNameRecord(int nameIndex) {return getWorkbook().getNameRecord(nameIndex);}

// Translation:
public NameRecord GetNameRecord(int nameIndex){return Workbook.GetNameRecord(nameIndex);}
// Original:
public DescribeJobResult describeJob(DescribeJobRequest request) {request = beforeClientExecution(request);return executeDescribeJob(request);}

// Translation:
public virtual DescribeJobResponse DescribeJob(DescribeJobRequest request){var options = new InvokeOptions();options.RequestMarshaller = DescribeJobRequestMarshaller.Instance;options.ResponseUnmarshaller = DescribeJobResponseUnmarshaller.Instance;return Invoke<DescribeJobResponse>(request, options);}
// Original:
public EscherPropertyMetaData( String description, byte type ){this.description = description;this.type = type;}

// Translation:
public EscherPropertyMetaData(String description, byte type){this.description = description;this.type = type;}
// Original:
public HSSFColor findSimilarColor(int red, int green, int blue) {HSSFColor result = null;int minColorDistance = Integer.MAX_VALUE;byte[] b = _palette.getColor(PaletteRecord.FIRST_COLOR_INDEX);for (short i = PaletteRecord.FIRST_COLOR_INDEX; b != null;b = _palette.getColor(++i)){int colorDistance = Math.abs(red - unsignedInt(b[0])) +Math.abs(green - unsignedInt(b[1])) +Math.abs(blue - unsignedInt(b[2]));if (colorDistance < minColorDistance){minColorDistance = colorDistance;result = getColor(i);}}return result;}

// Translation:
public HSSFColor FindSimilarColor(byte red, byte green, byte blue){HSSFColor result = null;int minColorDistance = int.MaxValue;byte[] b = palette.GetColor(PaletteRecord.FIRST_COLOR_INDEX);for (short i = (short)PaletteRecord.FIRST_COLOR_INDEX; b != null;b = palette.GetColor(++i)){int colorDistance = Math.Abs(red - b[0]) +Math.Abs(green - b[1]) + Math.Abs(blue - b[2]);if (colorDistance < minColorDistance){minColorDistance = colorDistance;result = GetColor(i);}}return result;}
// Original:
public synchronized StringBuffer deleteCharAt(int location) {deleteCharAt0(location);return this;}

// Translation:
public java.lang.StringBuffer deleteCharAt(int location){lock (this){deleteCharAt0(location);return this;}}