public final static Address[] getXRefList(CodeUnit cu, int maxNumber) {
		Program prog = cu.getProgram();
		if (prog == null) {
			return EMPTY_ADDR_ARRAY;
		}
		List<Address> xrefList = new ArrayList<>();
		// lookup the direct xrefs to the current code unit
		ReferenceIterator iter = prog.getReferenceManager().getReferencesTo(cu.getMinAddress());
		while (iter.hasNext()) {
			Reference ref = iter.next();
			xrefList.add(ref.getFromAddress());
			if (maxNumber > 0 && xrefList.size() == maxNumber) {
				break;
			}
		}
		Address[] arr = new Address[xrefList.size()];
		xrefList.toArray(arr);
		Arrays.sort(arr);
		return arr;
	}
Returns an array containing the first <b><code>maxNumber</code></b>
direct xref addresses to the specified code unit.

@param cu the code unit to generate the xrefs
@param maxNumber max number of xrefs to get,
                 or -1 to get all references

@return array first <b><code>maxNumber</code></b> xrefs to the code unit
Ghidra/Features/Base/src/main/java/ghidra/app/util/XReferenceUtil.java