fork download
  1. using System;
  2. using System.Text;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. ushort server_port = 25566;
  9. byte[] bytes = new byte[] {
  10. (byte) (server_port >> 8),
  11. (byte) server_port
  12. };
  13.  
  14. StringBuilder hex = new StringBuilder(bytes.Length * 2);
  15. foreach (byte b in bytes) {
  16. hex.AppendFormat("{0:x2}", b);
  17. }
  18.  
  19. Console.Write(hex);
  20. }
  21. }
Success #stdin #stdout 0.03s 33936KB
stdin
Standard input is empty
stdout
63de