C# ports of Java code