SWEEP: Removed unnecessary casts of int or long to (sbyte) prior to cast to (byte), as overflow automatically fixes this
diff --git a/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs b/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs
index 66538ee..d7b6787 100644
--- a/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs
+++ b/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs
@@ -139,7 +139,7 @@
                 switch (byteWidth)
                 {
                     case 1:
-                        data.WriteByte((byte)(sbyte) v);
+                        data.WriteByte((byte) v);
                         break;
                     case 2:
                         data.WriteInt16((short) v);
diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesWriter.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesWriter.cs
index 3d5cca8..9739692 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesWriter.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesWriter.cs
@@ -192,7 +192,7 @@
                 // pad to fit
                 for (int i = length; i < maxLength; i++)
                 {
-                    data.WriteByte((byte)(sbyte) ' ');
+                    data.WriteByte((byte) ' ');
                 }
                 SimpleTextUtil.WriteNewline(data);
                 SimpleTextUtil.Write(data, value == null ? "F" : "T", scratch);
diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosWriter.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosWriter.cs
index 0538bdc..7d20215 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosWriter.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Diagnostics;
+using Lucene.Net.Diagnostics;
 using Lucene.Net.Index;
 using Lucene.Net.Store;
 using Lucene.Net.Util;
@@ -101,7 +101,7 @@
                     {
                         // to allow null norm types we need to indicate if norms are written
                         // only in RW case
-                        output.WriteByte((byte)(sbyte)(fi.NormType == Index.DocValuesType.NONE ? 0 : 1));
+                        output.WriteByte((byte)(fi.NormType == Index.DocValuesType.NONE ? 0 : 1));
                     }
                     if (Debugging.AssertsEnabled) Debugging.Assert(fi.Attributes == null); // not used or supported
                 }
diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWNormsConsumer.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWNormsConsumer.cs
index b70ab92..704e5c8 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWNormsConsumer.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWNormsConsumer.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Diagnostics;
+using Lucene.Net.Diagnostics;
 using Lucene.Net.Index;
 using Lucene.Net.Store;
 using Lucene.Net.Util;
@@ -80,11 +80,11 @@
             if (Debugging.AssertsEnabled) Debugging.Assert(field.Number > lastFieldNumber,"writing norms fields out of order {0} -> {1}", lastFieldNumber, field.Number);
             foreach (var n in values)
             {
-                if (((sbyte)(byte)(long)n) < sbyte.MinValue || ((sbyte)(byte)(long)n) > sbyte.MaxValue)
+                if (((sbyte)n) < sbyte.MinValue || ((sbyte)n) > sbyte.MaxValue)
                 {
-                    throw new NotSupportedException("3.x cannot index norms that won't fit in a byte, got: " + ((sbyte)(byte)(long)n));
+                    throw new NotSupportedException("3.x cannot index norms that won't fit in a byte, got: " + ((sbyte)n));
                 }
-                @out.WriteByte((byte)(sbyte)n);
+                @out.WriteByte((byte)n);
             }
             lastFieldNumber = field.Number;
         }
diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWStoredFieldsWriter.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWStoredFieldsWriter.cs
index 608acc8..567cb2f 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWStoredFieldsWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWStoredFieldsWriter.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Diagnostics;
+using Lucene.Net.Diagnostics;
 using Lucene.Net.Documents;
 using Lucene.Net.Index;
 using Lucene.Net.Store;
@@ -159,7 +159,7 @@
                 }
             }
 
-            fieldsStream.WriteByte((byte)(sbyte)bits);
+            fieldsStream.WriteByte((byte)bits);
 
             if (bytes != null)
             {
diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40DocValuesWriter.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40DocValuesWriter.cs
index 0640c13..683c5ca 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40DocValuesWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40DocValuesWriter.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Diagnostics;
+using Lucene.Net.Diagnostics;
 using Lucene.Net.Index;
 using Lucene.Net.Store;
 using Lucene.Net.Support;
@@ -442,12 +442,12 @@
             if (Debugging.AssertsEnabled) Debugging.Assert(i >= 0 && i <= short.MaxValue);
             if (i < 128)
             {
-                o.WriteByte((byte)(sbyte)i);
+                o.WriteByte((byte)i);
             }
             else
             {
-                o.WriteByte((byte)unchecked((sbyte)(0x80 | (i >> 8))));
-                o.WriteByte((byte)unchecked((sbyte)(i & 0xff)));
+                o.WriteByte((byte)(0x80 | (i >> 8)));
+                o.WriteByte((byte)(i & 0xff));
             }
         }
 
@@ -466,7 +466,7 @@
             bool anyMissing = false;
             foreach (long n in docToOrd)
             {
-                if ((long)n == -1)
+                if (n == -1)
                 {
                     anyMissing = true;
                     break;
diff --git a/src/Lucene.Net.Tests/Index/TestCompoundFile.cs b/src/Lucene.Net.Tests/Index/TestCompoundFile.cs
index 7c53e49..b56f0ae 100644
--- a/src/Lucene.Net.Tests/Index/TestCompoundFile.cs
+++ b/src/Lucene.Net.Tests/Index/TestCompoundFile.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Documents;
+using Lucene.Net.Documents;
 using Lucene.Net.Store;
 using NUnit.Framework;
 using System;
@@ -310,7 +310,7 @@
             IndexOutput os = fsdir.CreateOutput(file, IOContext.DEFAULT);
             for (int i = 0; i < 2000; i++)
             {
-                os.WriteByte((byte)(sbyte)i);
+                os.WriteByte((byte)i);
             }
             os.Dispose();
 
@@ -632,7 +632,7 @@
             var largeBuf = new byte[2048];
             for (int i = 0; i < largeBuf.Length; i++)
             {
-                largeBuf[i] = (byte)unchecked((sbyte)(new Random(1).NextDouble() * 256));
+                largeBuf[i] = (byte)(new Random(1).NextDouble() * 256);
             }
 
             long currentPos = os.GetFilePointer();
@@ -823,7 +823,7 @@
             for (int fileIdx = 0; fileIdx < FILE_COUNT; fileIdx++)
             {
                 IndexOutput @out = d.CreateOutput("file." + fileIdx, NewIOContext(Random));
-                @out.WriteByte((byte)(sbyte)fileIdx);
+                @out.WriteByte((byte)fileIdx);
                 @out.Dispose();
             }
 
diff --git a/src/Lucene.Net.Tests/Index/TestIndexInput.cs b/src/Lucene.Net.Tests/Index/TestIndexInput.cs
index 3cdea38..5b3c809 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexInput.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexInput.cs
@@ -1,4 +1,4 @@
-using NUnit.Framework;
+using NUnit.Framework;
 using System;
 using System.IO;
 using Assert = Lucene.Net.TestFramework.Assert;
@@ -34,7 +34,51 @@
     [TestFixture]
     public class TestIndexInput : LuceneTestCase
     {
-        internal static readonly byte[] READ_TEST_BYTES = new byte[] { unchecked((byte)(sbyte)0x80), 0x01, unchecked((byte)(sbyte)0xFF), 0x7F, unchecked((byte)(sbyte)0x80), unchecked((byte)(sbyte)0x80), 0x01, unchecked((byte)(sbyte)0x81), unchecked((byte)(sbyte)0x80), 0x01, unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), 0x07, unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), 0x0F, unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), 0x07, unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), (byte)0x7F, 0x06, (byte)'L', (byte)'u', (byte)'c', (byte)'e', (byte)'n', (byte)'e', 0x02, unchecked((byte)(sbyte)0xC2), unchecked((byte)(sbyte)0xBF), 0x0A, (byte)'L', (byte)'u', unchecked((byte)(sbyte)0xC2), unchecked((byte)(sbyte)0xBF), (byte)(sbyte)'c', (byte)'e', unchecked((byte)(sbyte)0xC2), unchecked((byte)(sbyte)0xBF), (byte)'n', (byte)'e', 0x03, unchecked((byte)(sbyte)0xE2), unchecked((byte)(sbyte)0x98), unchecked((byte)(sbyte)0xA0), 0x0C, (byte)'L', (byte)'u', unchecked((byte)(sbyte)0xE2), unchecked((byte)(sbyte)0x98), unchecked((byte)(sbyte)0xA0), (byte)'c', (byte)'e', unchecked((byte)(sbyte)0xE2), unchecked((byte)(sbyte)0x98), unchecked((byte)(sbyte)0xA0), (byte)'n', (byte)'e', 0x04, unchecked((byte)(sbyte)0xF0), unchecked((byte)(sbyte)0x9D), unchecked((byte)(sbyte)0x84), unchecked((byte)(sbyte)0x9E), 0x08, unchecked((byte)(sbyte)0xF0), unchecked((byte)(sbyte)0x9D), unchecked((byte)(sbyte)0x84), unchecked((byte)(sbyte)0x9E), unchecked((byte)(sbyte)0xF0), unchecked((byte)(sbyte)0x9D), unchecked((byte)(sbyte)0x85), unchecked((byte)(sbyte)0xA0), 0x0E, (byte)'L', (byte)'u', unchecked((byte)(sbyte)0xF0), unchecked((byte)(sbyte)0x9D), unchecked((byte)(sbyte)0x84), unchecked((byte)(sbyte)0x9E), (byte)'c', (byte)'e', unchecked((byte)(sbyte)0xF0), unchecked((byte)(sbyte)0x9D), unchecked((byte)(sbyte)0x85), unchecked((byte)(sbyte)0xA0), (byte)'n', (byte)'e', 0x01, 0x00, 0x08, (byte)'L', (byte)'u', 0x00, (byte)'c', (byte)'e', 0x00, (byte)'n', (byte)'e', unchecked((byte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), (byte)0x17, (byte)0x01, unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), 0x01 };
+        internal static readonly byte[] READ_TEST_BYTES = new byte[] {
+            (byte) 0x80, 0x01,
+            (byte) 0xFF, 0x7F,
+            (byte) 0x80, (byte) 0x80, 0x01,
+            (byte) 0x81, (byte) 0x80, 0x01,
+            (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x07,
+            (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x0F,
+            (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x07,
+            (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x7F,
+            0x06, (byte) 'L', (byte) 'u', (byte) 'c', (byte) 'e', (byte) 'n', (byte) 'e',
+
+            // 2-byte UTF-8 (U+00BF "INVERTED QUESTION MARK") 
+            0x02, (byte) 0xC2, (byte) 0xBF,
+            0x0A, (byte) 'L', (byte) 'u', (byte) 0xC2, (byte) 0xBF,
+                  (byte) 'c', (byte) 'e', (byte) 0xC2, (byte) 0xBF,
+                  (byte) 'n', (byte) 'e',
+
+            // 3-byte UTF-8 (U+2620 "SKULL AND CROSSBONES") 
+            0x03, (byte) 0xE2, (byte) 0x98, (byte) 0xA0,
+            0x0C, (byte) 'L', (byte) 'u', (byte) 0xE2, (byte) 0x98, (byte) 0xA0,
+                  (byte) 'c', (byte) 'e', (byte) 0xE2, (byte) 0x98, (byte) 0xA0,
+                  (byte) 'n', (byte) 'e',
+
+            // surrogate pairs
+            // (U+1D11E "MUSICAL SYMBOL G CLEF")
+            // (U+1D160 "MUSICAL SYMBOL EIGHTH NOTE")
+            0x04, (byte) 0xF0, (byte) 0x9D, (byte) 0x84, (byte) 0x9E,
+            0x08, (byte) 0xF0, (byte) 0x9D, (byte) 0x84, (byte) 0x9E,
+                  (byte) 0xF0, (byte) 0x9D, (byte) 0x85, (byte) 0xA0,
+            0x0E, (byte) 'L', (byte) 'u',
+                  (byte) 0xF0, (byte) 0x9D, (byte) 0x84, (byte) 0x9E,
+                  (byte) 'c', (byte) 'e',
+                  (byte) 0xF0, (byte) 0x9D, (byte) 0x85, (byte) 0xA0,
+                  (byte) 'n', (byte) 'e',  
+
+            // null bytes
+            0x01, 0x00,
+            0x08, (byte) 'L', (byte) 'u', 0x00, (byte) 'c', (byte) 'e', 0x00, (byte) 'n', (byte) 'e',
+    
+            // tests for Exceptions on invalid values
+            (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x17,
+            (byte) 0x01, // guard value
+            (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+            (byte) 0x01, // guard value
+        };
 
         internal static readonly int COUNT = RandomMultiplier * 65536;
         internal static int[] INTS;
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
index 7e9ed60..dc706d8 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
@@ -1,4 +1,4 @@
-using J2N.Text;
+using J2N.Text;
 using J2N.Threading;
 using Lucene.Net.Analysis;
 using Lucene.Net.Analysis.TokenAttributes;
@@ -2341,7 +2341,7 @@
             {
                 // Create my own random file:
                 IndexOutput @out = dir.CreateOutput("myrandomfile", NewIOContext(Random));
-                @out.WriteByte((byte)(sbyte)42);
+                @out.WriteByte((byte)42);
                 @out.Dispose();
 
                 (new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random)))).Dispose();
@@ -2432,7 +2432,7 @@
             {
                 // Create my own random file:
                 IndexOutput @out = dir.CreateOutput("_a.frq", NewIOContext(Random));
-                @out.WriteByte((byte)(sbyte)42);
+                @out.WriteByte((byte)42);
                 @out.Dispose();
 
                 (new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random)))).Dispose();
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
index c9ca8a4..35b944d 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
@@ -1,4 +1,4 @@
-using J2N.Threading;
+using J2N.Threading;
 using J2N.Threading.Atomic;
 using Lucene.Net.Analysis;
 using Lucene.Net.Attributes;
@@ -1347,7 +1347,7 @@
             IndexOutput @out = dir.CreateOutput(IndexFileNames.FileNameFromGeneration(IndexFileNames.SEGMENTS, "", 1 + gen), NewIOContext(Random));
             @out.CopyBytes(@in, @in.Length - 1);
             byte b = @in.ReadByte();
-            @out.WriteByte((byte)(sbyte)(1 + b));
+            @out.WriteByte((byte)(1 + b));
             @out.Dispose();
             @in.Dispose();
 
diff --git a/src/Lucene.Net.Tests/Store/TestDirectory.cs b/src/Lucene.Net.Tests/Store/TestDirectory.cs
index 4fb2d95..4d1913e 100644
--- a/src/Lucene.Net.Tests/Store/TestDirectory.cs
+++ b/src/Lucene.Net.Tests/Store/TestDirectory.cs
@@ -1,4 +1,4 @@
-using J2N;
+using J2N;
 using J2N.Threading;
 using Lucene.Net.Attributes;
 using Lucene.Net.Support;
@@ -194,7 +194,7 @@
                 string fname = "foo." + i;
                 string lockname = "foo" + i + ".lck";
                 IndexOutput @out = dir.CreateOutput(fname, NewIOContext(Random));
-                @out.WriteByte((byte)(sbyte)i);
+                @out.WriteByte((byte)i);
                 @out.WriteBytes(largeBuffer, largeBuffer.Length);
                 @out.Dispose();
 
diff --git a/src/Lucene.Net.Tests/Store/TestHugeRamFile.cs b/src/Lucene.Net.Tests/Store/TestHugeRamFile.cs
index 22f9558..40f6b12 100644
--- a/src/Lucene.Net.Tests/Store/TestHugeRamFile.cs
+++ b/src/Lucene.Net.Tests/Store/TestHugeRamFile.cs
@@ -1,4 +1,4 @@
-using NUnit.Framework;
+using NUnit.Framework;
 using System;
 using System.Collections.Generic;
 using Assert = Lucene.Net.TestFramework.Assert;
@@ -73,11 +73,11 @@
             var b2 = new byte[RAMOutputStream.BUFFER_SIZE / 3];
             for (int i = 0; i < b1.Length; i++)
             {
-                b1[i] = (byte)(sbyte)(i & 0x0007F);
+                b1[i] = (byte)(i & 0x0007F);
             }
             for (int i = 0; i < b2.Length; i++)
             {
-                b2[i] = (byte)(sbyte)(i & 0x0003F);
+                b2[i] = (byte)(i & 0x0003F);
             }
             long n = 0;
             Assert.AreEqual(n, @out.Length, "output length must match");
diff --git a/src/Lucene.Net.Tests/Util/TestPagedBytes.cs b/src/Lucene.Net.Tests/Util/TestPagedBytes.cs
index 3a2c679..2b67251 100644
--- a/src/Lucene.Net.Tests/Util/TestPagedBytes.cs
+++ b/src/Lucene.Net.Tests/Util/TestPagedBytes.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Store;
+using Lucene.Net.Store;
 using Lucene.Net.Support;
 using NUnit.Framework;
 using System;
@@ -194,7 +194,7 @@
             var arr = new byte[TestUtil.NextInt32(Random, blockSize / 2, blockSize * 2)];
             for (int i = 0; i < arr.Length; ++i)
             {
-                arr[i] = (byte)(sbyte)i;
+                arr[i] = (byte)i;
             }
             long numBytes = (1L << 31) + TestUtil.NextInt32(Random, 1, blockSize * 3);
             var p = new PagedBytes(blockBits);
diff --git a/src/Lucene.Net/Codecs/BlockTreeTermsWriter.cs b/src/Lucene.Net/Codecs/BlockTreeTermsWriter.cs
index 2b2e54d..342bbdd 100644
--- a/src/Lucene.Net/Codecs/BlockTreeTermsWriter.cs
+++ b/src/Lucene.Net/Codecs/BlockTreeTermsWriter.cs
@@ -1,4 +1,4 @@
-using J2N.Text;
+using J2N.Text;
 using Lucene.Net.Diagnostics;
 using Lucene.Net.Support;
 using Lucene.Net.Util.Fst;
@@ -517,7 +517,7 @@
                         //if (DEBUG) {
                         //  System.out.println("    write floorLeadByte=" + Integer.toHexString(sub.floorLeadByte&0xff));
                         //}
-                        scratchBytes.WriteByte((byte)(sbyte)sub.FloorLeadByte);
+                        scratchBytes.WriteByte((byte)sub.FloorLeadByte);
                         if (Debugging.AssertsEnabled) Debugging.Assert(sub.Fp > Fp);
                         scratchBytes.WriteVInt64((sub.Fp - Fp) << 1 | (uint)(sub.HasTerms ? 1 : 0));
                     }
diff --git a/src/Lucene.Net/Codecs/Compressing/CompressingTermVectorsWriter.cs b/src/Lucene.Net/Codecs/Compressing/CompressingTermVectorsWriter.cs
index 1faa1c1..3bc953f 100644
--- a/src/Lucene.Net/Codecs/Compressing/CompressingTermVectorsWriter.cs
+++ b/src/Lucene.Net/Codecs/Compressing/CompressingTermVectorsWriter.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Diagnostics;
+using Lucene.Net.Diagnostics;
 using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
@@ -478,7 +478,7 @@
             if (Debugging.AssertsEnabled) Debugging.Assert(numDistinctFields > 0);
             int bitsRequired = PackedInt32s.BitsRequired(fieldNums.Max);
             int token = (Math.Min(numDistinctFields - 1, 0x07) << 5) | bitsRequired;
-            vectorsStream.WriteByte((byte)(sbyte)token);
+            vectorsStream.WriteByte((byte)token);
             if (numDistinctFields - 1 >= 0x07)
             {
                 vectorsStream.WriteVInt32(numDistinctFields - 1 - 0x07);
diff --git a/src/Lucene.Net/Codecs/Compressing/LZ4.cs b/src/Lucene.Net/Codecs/Compressing/LZ4.cs
index 7df0575..70c910d 100644
--- a/src/Lucene.Net/Codecs/Compressing/LZ4.cs
+++ b/src/Lucene.Net/Codecs/Compressing/LZ4.cs
@@ -1,4 +1,4 @@
-using J2N.Numerics;
+using J2N.Numerics;
 using Lucene.Net.Diagnostics;
 using Lucene.Net.Support;
 using System;
@@ -177,16 +177,16 @@
         {
             while (l >= 0xFF)
             {
-                @out.WriteByte(unchecked((byte)(sbyte)0xFF));
+                @out.WriteByte(/*(byte)*/0xFF); // LUCENENET: Removed unnecessary cast
                 l -= 0xFF;
             }
-            @out.WriteByte((byte)(sbyte)l);
+            @out.WriteByte((byte)l);
         }
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         private static void EncodeLiterals(byte[] bytes, int token, int anchor, int literalLen, DataOutput @out)
         {
-            @out.WriteByte((byte)(sbyte)token);
+            @out.WriteByte((byte)token);
 
             // encode literal length
             if (literalLen >= 0x0F)
@@ -216,8 +216,8 @@
             // encode match dec
             int matchDec = matchOff - matchRef;
             if (Debugging.AssertsEnabled) Debugging.Assert(matchDec > 0 && matchDec < 1 << 16);
-            @out.WriteByte((byte)(sbyte)matchDec);
-            @out.WriteByte((byte)(sbyte)((int)((uint)matchDec >> 8)));
+            @out.WriteByte((byte)matchDec);
+            @out.WriteByte((byte)(int)((uint)matchDec >> 8));
 
             // encode match len
             if (matchLen >= MIN_MATCH + 0x0F)
diff --git a/src/Lucene.Net/Codecs/Lucene40/Lucene40SegmentInfoWriter.cs b/src/Lucene.Net/Codecs/Lucene40/Lucene40SegmentInfoWriter.cs
index 8b4b00f..15e3fc3 100644
--- a/src/Lucene.Net/Codecs/Lucene40/Lucene40SegmentInfoWriter.cs
+++ b/src/Lucene.Net/Codecs/Lucene40/Lucene40SegmentInfoWriter.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Support;
+using Lucene.Net.Support;
 using System;
 
 namespace Lucene.Net.Codecs.Lucene40
@@ -60,7 +60,7 @@
                 output.WriteString(si.Version);
                 output.WriteInt32(si.DocCount);
 
-                output.WriteByte((byte)(sbyte)(si.UseCompoundFile ? SegmentInfo.YES : SegmentInfo.NO));
+                output.WriteByte((byte)(si.UseCompoundFile ? SegmentInfo.YES : SegmentInfo.NO));
                 output.WriteStringStringMap(si.Diagnostics);
                 output.WriteStringStringMap(Collections.EmptyMap<string, string>());
                 output.WriteStringSet(si.GetFiles());
diff --git a/src/Lucene.Net/Codecs/Lucene40/Lucene40StoredFieldsWriter.cs b/src/Lucene.Net/Codecs/Lucene40/Lucene40StoredFieldsWriter.cs
index 47bf7c8..67e292f 100644
--- a/src/Lucene.Net/Codecs/Lucene40/Lucene40StoredFieldsWriter.cs
+++ b/src/Lucene.Net/Codecs/Lucene40/Lucene40StoredFieldsWriter.cs
@@ -1,4 +1,4 @@
-using J2N;
+using J2N;
 using Lucene.Net.Diagnostics;
 using Lucene.Net.Documents;
 using System;
@@ -217,7 +217,7 @@
                 }
             }
 
-            fieldsStream.WriteByte((byte)(sbyte)bits);
+            fieldsStream.WriteByte((byte)bits);
 
             if (bytes != null)
             {
diff --git a/src/Lucene.Net/Codecs/Lucene41/ForUtil.cs b/src/Lucene.Net/Codecs/Lucene41/ForUtil.cs
index 4406d54..975221e 100644
--- a/src/Lucene.Net/Codecs/Lucene41/ForUtil.cs
+++ b/src/Lucene.Net/Codecs/Lucene41/ForUtil.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Diagnostics;
+using Lucene.Net.Diagnostics;
 using Lucene.Net.Store;
 using Lucene.Net.Support;
 using Lucene.Net.Util.Packed;
@@ -165,7 +165,7 @@
         {
             if (IsAllEqual(data))
             {
-                @out.WriteByte((byte)(sbyte)ALL_VALUES_EQUAL);
+                @out.WriteByte((byte)ALL_VALUES_EQUAL);
                 @out.WriteVInt32(data[0]);
                 return;
             }
diff --git a/src/Lucene.Net/Codecs/Lucene46/Lucene46SegmentInfoWriter.cs b/src/Lucene.Net/Codecs/Lucene46/Lucene46SegmentInfoWriter.cs
index aaa3869..35af117 100644
--- a/src/Lucene.Net/Codecs/Lucene46/Lucene46SegmentInfoWriter.cs
+++ b/src/Lucene.Net/Codecs/Lucene46/Lucene46SegmentInfoWriter.cs
@@ -1,4 +1,4 @@
-namespace Lucene.Net.Codecs.Lucene46
+namespace Lucene.Net.Codecs.Lucene46
 {
     /*
      * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -56,7 +56,7 @@
                 output.WriteString(si.Version);
                 output.WriteInt32(si.DocCount);
 
-                output.WriteByte((byte)(sbyte)(si.UseCompoundFile ? SegmentInfo.YES : SegmentInfo.NO));
+                output.WriteByte((byte)(si.UseCompoundFile ? SegmentInfo.YES : SegmentInfo.NO));
                 output.WriteStringStringMap(si.Diagnostics);
                 output.WriteStringSet(si.GetFiles());
                 CodecUtil.WriteFooter(output);
diff --git a/src/Lucene.Net/Index/SegmentInfos.cs b/src/Lucene.Net/Index/SegmentInfos.cs
index bdfc679..b9b396d 100644
--- a/src/Lucene.Net/Index/SegmentInfos.cs
+++ b/src/Lucene.Net/Index/SegmentInfos.cs
@@ -1,4 +1,4 @@
-using J2N;
+using J2N;
 using J2N.Collections.Generic.Extensions;
 using Lucene.Net.Diagnostics;
 using Lucene.Net.Support;
@@ -672,7 +672,7 @@
 
                 output.WriteStringStringMap(si.Attributes);
 
-                output.WriteByte((byte)(sbyte)(si.UseCompoundFile ? SegmentInfo.YES : SegmentInfo.NO));
+                output.WriteByte((byte)(si.UseCompoundFile ? SegmentInfo.YES : SegmentInfo.NO));
                 output.WriteStringStringMap(si.Diagnostics);
                 output.WriteStringSet(si.GetFiles());
 
diff --git a/src/Lucene.Net/Store/DataOutput.cs b/src/Lucene.Net/Store/DataOutput.cs
index 93493e4..c86194c 100644
--- a/src/Lucene.Net/Store/DataOutput.cs
+++ b/src/Lucene.Net/Store/DataOutput.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Diagnostics;
+using Lucene.Net.Diagnostics;
 using System.Collections.Generic;
 using System.IO;
 
@@ -72,10 +72,10 @@
         /// <seealso cref="DataInput.ReadInt32()"/>
         public virtual void WriteInt32(int i)
         {
-            WriteByte((byte)(sbyte)(i >> 24));
-            WriteByte((byte)(sbyte)(i >> 16));
-            WriteByte((byte)(sbyte)(i >> 8));
-            WriteByte((byte)(sbyte)i);
+            WriteByte((byte)(i >> 24));
+            WriteByte((byte)(i >> 16));
+            WriteByte((byte)(i >> 8));
+            WriteByte((byte)i);
         }
 
         /// <summary>
@@ -86,8 +86,8 @@
         /// <seealso cref="DataInput.ReadInt16()"/>
         public virtual void WriteInt16(short i)
         {
-            WriteByte((byte)(sbyte)((ushort)i >> 8));
-            WriteByte((byte)(sbyte)(ushort)i);
+            WriteByte((byte)((ushort)i >> 8));
+            WriteByte((byte)(ushort)i);
         }
 
         /// <summary>
@@ -199,10 +199,10 @@
         {
             while ((i & ~0x7F) != 0)
             {
-                WriteByte((byte)unchecked((sbyte)((i & 0x7F) | 0x80)));
+                WriteByte((byte)((i & 0x7F) | 0x80));
                 i = (int)((uint)i >> 7);
             }
-            WriteByte((byte)(sbyte)i);
+            WriteByte((byte)i);
         }
 
         /// <summary>
@@ -234,10 +234,10 @@
             if (Debugging.AssertsEnabled) Debugging.Assert(i >= 0L);
             while ((i & ~0x7FL) != 0L)
             {
-                WriteByte((byte)unchecked((sbyte)((i & 0x7FL) | 0x80L)));
+                WriteByte((byte)((i & 0x7FL) | 0x80L));
                 i = (long)((ulong)i >> 7);
             }
-            WriteByte((byte)(sbyte)i);
+            WriteByte((byte)i);
         }
 
         /// <summary>
diff --git a/src/Lucene.Net/Util/Fst/FST.cs b/src/Lucene.Net/Util/Fst/FST.cs
index fe0379c..8c7d8a1 100644
--- a/src/Lucene.Net/Util/Fst/FST.cs
+++ b/src/Lucene.Net/Util/Fst/FST.cs
@@ -1,4 +1,4 @@
-using J2N.Collections;
+using J2N.Collections;
 using Lucene.Net.Diagnostics;
 using Lucene.Net.Support;
 using System;
@@ -594,7 +594,7 @@
             if (inputType == FST.INPUT_TYPE.BYTE1)
             {
                 if (Debugging.AssertsEnabled) Debugging.Assert(v <= 255,"v={0}", v);
-                @out.WriteByte((byte)(sbyte)v);
+                @out.WriteByte((byte)v);
             }
             else if (inputType == FST.INPUT_TYPE.BYTE2)
             {
@@ -723,7 +723,7 @@
                     flags += FST.BIT_ARC_HAS_OUTPUT;
                 }
 
-                bytes.WriteByte((byte)(sbyte)flags);
+                bytes.WriteByte((byte)flags);
                 WriteLabel(bytes, arc.Label);
 
                 // System.out.println("  write arc: label=" + (char) arc.Label + " flags=" + flags + " target=" + target.Node + " pos=" + bytes.getPosition() + " output=" + outputs.outputToString(arc.Output));
@@ -1886,7 +1886,7 @@
                             }
 
                             if (Debugging.AssertsEnabled) Debugging.Assert(flags != FST.ARCS_AS_FIXED_ARRAY);
-                            writer.WriteByte((byte)(sbyte)flags);
+                            writer.WriteByte((byte)flags);
 
                             fst.WriteLabel(writer, arc.Label);
 
diff --git a/src/Lucene.Net/Util/PForDeltaDocIdSet.cs b/src/Lucene.Net/Util/PForDeltaDocIdSet.cs
index e98da7c..a3b61b1 100644
--- a/src/Lucene.Net/Util/PForDeltaDocIdSet.cs
+++ b/src/Lucene.Net/Util/PForDeltaDocIdSet.cs
@@ -1,4 +1,4 @@
-using J2N.Numerics;
+using J2N.Numerics;
 using Lucene.Net.Diagnostics;
 using Lucene.Net.Support;
 using System;
@@ -252,15 +252,15 @@
                 if (numExceptions > 0)
                 {
                     if (Debugging.AssertsEnabled) Debugging.Assert(bitsPerException > 0);
-                    data.WriteByte((byte)(sbyte)numExceptions);
-                    data.WriteByte((byte)(sbyte)bitsPerException);
+                    data.WriteByte((byte)numExceptions);
+                    data.WriteByte((byte)bitsPerException);
                     PackedInt32s.IEncoder encoder = PackedInt32s.GetEncoder(PackedInt32s.Format.PACKED, PackedInt32s.VERSION_CURRENT, bitsPerException);
                     int numIterations = (numExceptions + encoder.ByteValueCount - 1) / encoder.ByteValueCount;
                     encoder.Encode(exceptions, 0, data.Bytes, data.Length, numIterations);
                     data.Length += (int)PackedInt32s.Format.PACKED.ByteCount(PackedInt32s.VERSION_CURRENT, numExceptions, bitsPerException);
                     for (int i = 0; i < numExceptions; ++i)
                     {
-                        data.WriteByte((byte)(sbyte)exceptionIndices[i]);
+                        data.WriteByte((byte)exceptionIndices[i]);
                     }
                 }
             }
@@ -274,7 +274,7 @@
                     doc += 1 + buffer[i];
                     while (doc >= 8)
                     {
-                        data.WriteByte((byte)(sbyte)current);
+                        data.WriteByte((byte)current);
                         current = 0;
                         doc -= 8;
                     }
@@ -282,7 +282,7 @@
                 }
                 if (current != 0)
                 {
-                    data.WriteByte((byte)(sbyte)current);
+                    data.WriteByte((byte)current);
                 }
             }
 
@@ -305,7 +305,7 @@
                     {
                         token |= HAS_EXCEPTIONS;
                     }
-                    data.WriteByte((byte)(sbyte)token);
+                    data.WriteByte((byte)token);
                     PforEncode();
                 }
                 else
@@ -313,13 +313,13 @@
                     // use unary
                     blockSize = unaryBlockSize;
                     int token = UNARY | (bufferSize < BLOCK_SIZE ? LAST_BLOCK : 0);
-                    data.WriteByte((byte)(sbyte)token);
+                    data.WriteByte((byte)token);
                     UnaryEncode();
                 }
 
                 if (bufferSize < BLOCK_SIZE)
                 {
-                    data.WriteByte((byte)(sbyte)bufferSize);
+                    data.WriteByte((byte)bufferSize);
                 }
 
                 ++numBlocks;
diff --git a/src/Lucene.Net/Util/Packed/AbstractBlockPackedWriter.cs b/src/Lucene.Net/Util/Packed/AbstractBlockPackedWriter.cs
index 294e514..78a3d2c 100644
--- a/src/Lucene.Net/Util/Packed/AbstractBlockPackedWriter.cs
+++ b/src/Lucene.Net/Util/Packed/AbstractBlockPackedWriter.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Diagnostics;
+using Lucene.Net.Diagnostics;
 using Lucene.Net.Support;
 using System;
 using System.Runtime.CompilerServices;
@@ -47,10 +47,10 @@
             int k = 0;
             while ((i & ~0x7FL) != 0L && k++ < 8)
             {
-                @out.WriteByte(unchecked((byte)(sbyte)((i & 0x7FL) | 0x80L)));
+                @out.WriteByte((byte)((i & 0x7FL) | 0x80L));
                 i = (long)((ulong)i >> 7);
             }
-            @out.WriteByte((byte)(sbyte)i);
+            @out.WriteByte((byte)i);
         }
 
         protected DataOutput m_out;
diff --git a/src/Lucene.Net/Util/Packed/BlockPackedWriter.cs b/src/Lucene.Net/Util/Packed/BlockPackedWriter.cs
index c6f579a..4ec3645 100644
--- a/src/Lucene.Net/Util/Packed/BlockPackedWriter.cs
+++ b/src/Lucene.Net/Util/Packed/BlockPackedWriter.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Diagnostics;
+using Lucene.Net.Diagnostics;
 using System;
 using System.Runtime.CompilerServices;
 
@@ -93,7 +93,7 @@
             }
 
             int token = (bitsRequired << BPV_SHIFT) | (min == 0 ? MIN_VALUE_EQUALS_0 : 0);
-            m_out.WriteByte((byte)(sbyte)token);
+            m_out.WriteByte((byte)token);
 
             if (min != 0)
             {
diff --git a/src/Lucene.Net/Util/Packed/PackedDataOutput.cs b/src/Lucene.Net/Util/Packed/PackedDataOutput.cs
index 39e13da..6c9e390 100644
--- a/src/Lucene.Net/Util/Packed/PackedDataOutput.cs
+++ b/src/Lucene.Net/Util/Packed/PackedDataOutput.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Diagnostics;
+using Lucene.Net.Diagnostics;
 using System;
 using System.Runtime.CompilerServices;
 
@@ -58,7 +58,7 @@
             {
                 if (remainingBits == 0)
                 {
-                    @out.WriteByte((byte)(sbyte)current);
+                    @out.WriteByte((byte)current);
                     current = 0L;
                     remainingBits = 8;
                 }
@@ -77,7 +77,7 @@
         {
             if (remainingBits < 8)
             {
-                @out.WriteByte((byte)(sbyte)current);
+                @out.WriteByte((byte)current);
             }
             remainingBits = 8;
             current = 0L;
diff --git a/src/Lucene.Net/Util/WAH8DocIdSet.cs b/src/Lucene.Net/Util/WAH8DocIdSet.cs
index 844aaac..7ebe22c 100644
--- a/src/Lucene.Net/Util/WAH8DocIdSet.cs
+++ b/src/Lucene.Net/Util/WAH8DocIdSet.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Diagnostics;
+using Lucene.Net.Diagnostics;
 using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
@@ -324,7 +324,7 @@
                 {
                     token |= 1 << 3;
                 }
-                @out.WriteByte((byte)(sbyte)token);
+                @out.WriteByte((byte)token);
                 if (cleanLengthMinus2 > 0x03)
                 {
                     @out.WriteVInt32((int)((uint)cleanLengthMinus2 >> 2));