# sys::Sys

    sys::Obj
      sys::Sys

`public class Sys`

Sys provides access to the system environment.

app

  `public static inline App app`

  The application instance for the VM

bootTime

  `public static long bootTime`

  The time in nanosecond ticks the Sedona runtime was booted

kits

  `public static const Kit[] kits`

  The list of kits installed in this environment.

kitsLen

  `public static const define int kitsLen`

  The number of items in the kits array.

logLevels

  `public static inline byte[] logLevels`

  The current severity level of each log

logs

  `public static const Log[] logs`

  The list of logs installed in this environment.

logsLen

  `public static const define int logsLen`

  The number of items in the logs array.

maxInt

  `public static const define int maxInt`

  Max value of a 32-bit signed integer: 2,147,483,647

maxLong

  `public static const define long maxLong`

  Max value of a 64-bit signed integer: 9,223,372,036,854,775,807

minInt

  `public static const define int minInt`

  Min value of a 32-bit signed integer: -2,147,483,648

minLong

  `public static const define long minLong`

  Min value of a 64-bit signed integer: -9,223,372,036,854,775,808

nullIn

  `public static inline InStream nullIn`

  The null input stream is always at end of file.

nullOut

  `public static inline OutStream nullOut`

  The null output stream sinks its output to nowhere.

out

  `public static inline OutStream out`

  Standard output stream.

sizeofRef

  `public static const define int sizeofRef`

  Size in bytes of a reference/pointer on this system.

andBytes

  `public static native void andBytes(int mask, byte[] bytes, int off, int len)`

  Perform a bitwise "and" using the specified mask on each byte in the bytes array.

bitsToDouble

  `public static native double bitsToDouble(long bits)`

  Return a 64-bit floating point value according to the IEEE 754 floating-point "double format" bit layout.

bitsToFloat

  `public static native float bitsToFloat(int bits)`

  Return a 32-bit floating point value according to the IEEE 754 floating-point "single format" bit layout.

compareBytes

  `public static native int compareBytes(byte[] a, int aOff, byte[] b, int bOff, int len)`

  Compare two byte arrays for equality. If equal return 0, if a is less than b return -1, if a greater than b return 1.

copy

  `public static native void copy(byte[] src, int srcOff, byte[] dest, int destOff, int num)`

  Copy num bytes from the source byte array to the destination byte array. The arrays may be overlapping (like memmove, not memcpy).

doubleStr

  `public static native Str doubleStr(double v)`

  Format a double into a string. The string is stored in a static shared buffer.

doubleToBits

  `public static native long doubleToBits(double v)`

  Return a long representation of a 64-bit floating point value according to the IEEE 754 floating-point "double format" bit layout.

findKit

  `public static Kit findKit(Str name)`

  Find a kit by its unique name or return null if not found.

findLog

  `public static Log findLog(Str qname)`

  Find a log by its qualified name or return null if not found.

findType

  `public static Type findType(Str qname)`

  Find a type by its qualified name such as "sys::Component" or return null if not found.

floatStr

  `public static native Str floatStr(float v)`

  Format a float into a string. The string is stored in a static shared buffer.

floatToBits

  `public static native int floatToBits(float v)`

  Return an integer representation of a 32-bit floating point value according to the IEEE 754 floating-point "single format" bit layout.

fromDigit

  `public static int fromDigit(int digit)`

  Return the numeric value of a decimal character:

        '0' -> 0
        '9' -> 9

  Return -1 if not a valid decimal digit.

fromHexDigit

  `public static int fromHexDigit(int digit)`

  Return the numeric value of an decimal character:

        '0' -> 0
        '9' -> 9
        'a' or 'A' -> 10
        'f' or 'F' -> 15

  Return -1 if not a valid hex digit.

hexStr

  `public static native Str hexStr(int v)`

  Format an integer as a hexadecimal string. The string is stored in a static shared buffer.

intStr

  `public static native Str intStr(int v)`

  Format an integer as a decimal string. The string is stored in a static shared buffer.

kit

  `public static Kit kit(int id)`

  Get the kit for the specified id or return null if out of range.

log

  `public static Log log(int id)`

  Get the log for the specified id or return null if out of range.

longHexStr

  `public static native Str longHexStr(long v)`

  Format the 64-bit integer into a hexidecimal string. The string is stored in a static shared buffer.

longStr

  `public static native Str longStr(long v)`

  Format the 64-bit integer into a string. The string is stored in a static shared buffer.

main

  `public static int main(Str[] args, int argsLen)`

  Standard main entry point.

max

  `public static int max(int a, int b)`

  Return the max of two ints.

min

  `public static int min(int a, int b)`

  Return the min of two ints.

orBytes

  `public static native void orBytes(int mask, byte[] bytes, int off, int len)`

  Perform a bitwise "or" using the specified mask on each byte in the bytes array.

printVer

  `public static void printVer(OutStream out)`

  Print version information to the output stream.

rand

  `public static native int rand()`

  Generate a random 32-bit integer.

resume

  `public static int resume(Str[] args, int argsLen)`

  This is the entry point where native code resumes the Sedona VM from a yield or hibernate state. VM heap remains intact.

scodeAddr

  `public static native byte[] scodeAddr()`

  Get the base address of the scode image as a byte pointer. INTERNAL USE ONLY.

setBytes

  `public static native void setBytes(int val, byte[] bytes, int off, int len)`

  Set all the bytes in the specified array to val.

shutdown

  `public static int shutdown(int result)`

  This method unwinds the Sedona call stack and the VM exits with the given error code.

  If it returns 'Err.hibernate' or 'Err.yield', the Sedona heap remains intact and can be restarted via 'resume' entry point

  If the specified result is not the hibernate or yield error codes, then stop the application and cleanup memory.

sleep

  `public static native void sleep(long t)`

  Sleep for the specified time in nanosecond ticks. If t <= 0, then sleep should return immediately.

  This method is for use by App and test code only. Do not call from within Component execute() or Service work() methods.

ticks

  `public static native long ticks()`

  Get the current time as a 64-bit integer of nanosecond ticks. Ticks are not necessarily based on wall-time, but rather based on an arbitrary epoch (typically the boot time of the host)

type

  `public static Type type(int kitId, int typeId)`

  Get the type for the specified kit and type id or return null if out of range.